2012-10-15 16 views
6

Tôi đang cố gắng triển khai bản sao phát triển/kiểm tra được đặt trên macbook pro của tôi bằng tài liệu này.Làm thế nào tôi có thể sửa "EMPTYUNREACHABLE" khi triển khai một thử nghiệm replset trên mac của tôi?

http://docs.mongodb.org/manual/tutorial/deploy-replica-set/

tôi bắt đầu 3 trường hợp mongod, mỗi trên cổng 10001, 10002, 10003 tôi đã sử dụng các tập tin cấu hình để bắt đầu mongod. Các tập tin cấu hình dưới đây:

rs0: 

dbpath = /Users/Thomas/mongodb/data/rs0/ 
port = 10000 
logpath = /Users/Thomas/mongodb/log/rs0.log 
logappend = true 
replSet = rs0 

rs1: 

dbpath = /Users/Thomas/mongodb/data/rs1/ 
port = 10001 
logpath = /Users/Thomas/mongodb/log/rs1.log 
logappend = true 
replSet = rs0 

rs2: 

dbpath = /Users/Thomas/mongodb/data/rs2/ 
port = 10002 
logpath = /Users/Thomas/mongodb/log/rs2.log 
logappend = true 
replSet = rs0 

Và bằng cách sử dụng lệnh sau để bắt đầu:

mongod -f config/rs0.conf 
mongod -f config/rs1.conf 
mongod -f config/rs2.conf 

sau đó tôi kết nối với nó bằng cách sử Mongo: Mongo localhost: 10001, nhưng khi tôi sử dụng rs.initiate() lệnh để khởi tạo bộ repl, nó thất bại.

> rs.initiate() 
{ 
"startupStatus" : 4, 
"info" : "rs0", 
"errmsg" : "all members and seeds must be reachable to initiate set", 
"ok" : 0 
} 

và kiểm tra bằng cách rs.status()

> rs.status() 
{ 
"startupStatus" : 4, 
"errmsg" : "can't currently get local.system.replset config from self or any seed (EMPTYUNREACHABLE)", 
"ok" : 0 
} 

Và nhật ký cho thấy đó là một lỗi EMPTYUNREACHABLE. làm thế nào có thể giải quyết nó?

***** SERVER RESTARTED ***** 

Mon Oct 15 22:02:31 [initandlisten] MongoDB starting : pid=568 port=10000    dbpath=/Users/Thomas/mongodb/data/rs0/ 64-bit host=bogon 
Mon Oct 15 22:02:31 [initandlisten] 
Mon Oct 15 22:02:31 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 
Mon Oct 15 22:02:31 [initandlisten] db version v2.2.0, pdfile version 4.5 
Mon Oct 15 22:02:31 [initandlisten] git version: f5e83eae9cfbec7fb7a071321928f00d1b0c5207 
Mon Oct 15 22:02:31 [initandlisten] build info: Darwin bs-osx-106-x86-64-1.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_49 
Mon Oct 15 22:02:31 [initandlisten] options: { config: "config/rs0.conf", dbpath: "/Users/Thomas/mongodb/data/rs0/", logappend: "true", logpath: "/Users/Thomas/mongodb/log/rs0.log", port: 10000, replSet: "rs0", rest: "true" } 
Mon Oct 15 22:02:31 [initandlisten] journal dir=/Users/Thomas/mongodb/data/rs0/journal 
Mon Oct 15 22:02:31 [initandlisten] recover : no journal files present, no recovery needed 
Mon Oct 15 22:02:31 [websvr] admin web console waiting for connections on port 11000 
Mon Oct 15 22:02:31 [initandlisten] waiting for connections on port 10000 
Mon Oct 15 22:02:37 [rsStart] trying to contact bogon:10000 
Mon Oct 15 22:02:43 [rsStart] couldn't connect to bogon:10000: couldn't connect to server bogon:10000 
Mon Oct 15 22:02:49 [rsStart] replSet can't get local.system.replset config from self or any seed (yet) 
Mon Oct 15 22:03:05 [rsStart] trying to contact bogon:10000 
Mon Oct 15 22:03:11 [rsStart] couldn't connect to bogon:10000: couldn't connect to server bogon:10000 
Mon Oct 15 22:03:17 [rsStart] replSet can't get local.system.replset config from self or any seed (yet) 
Mon Oct 15 22:03:33 [rsStart] trying to contact bogon:10000 
Mon Oct 15 22:03:39 [rsStart] couldn't connect to bogon:10000: couldn't connect to server bogon:10000 
Mon Oct 15 22:03:45 [rsStart] replSet can't get local.system.replset config from self or any seed (yet) 
Mon Oct 15 22:04:01 [rsStart] trying to contact bogon:10000 
Mon Oct 15 22:04:07 [rsStart] couldn't connect to bogon:10000: couldn't connect to server bogon:10000 
Mon Oct 15 22:04:13 [rsStart] replSet can't get local.system.replset config from self or any seed (yet) 

Trả lời

8

Thử đặt bind_ip thành 127.0.0.1 hoặc thêm mục nhập cho `bogon 'vào/etc/hosts của bạn?

mongodb dường như nhận được tên máy chủ() cho hệ thống cục bộ nhưng không thể giải quyết được.

+1

OH, cảm ơn bạn rất nhiều, tôi đã thử cách/etc/hosts và vấn đề đã được giải quyết. Cám ơn bạn một lần nữa. –

2

Tôi đã gặp sự cố chính xác ngay hôm nay. Tôi đã có thể bắt đầu mongodb nhưng không phải là bản sao bộ. Tôi đã phải xóa dòng sau từ tập tin mongod.conf

'bind_ip: '127.0.0.1''

Tôi cũng đã tìm ra rằng các tập tin mongod.conf cho MongoDB và bản sao bộ là khác nhau và bảo quản ở các vị trí khác nhau, có thể vì tôi đã cài đặt phiên bản mới nhất của mongodb ?. Tôi tìm thấy tập tin cấu hình tập bản sao của tôi tại "/usr/local/etc/mongod.conf".

0

FYI, tôi tin rằng bạn nhấn lỗi này trong 2.2.0:

https://jira.mongodb.org/browse/SERVER-7367

Nó bây giờ là cố định và dự kiến ​​phát hành trong 2.2.1 - các bản sửa lỗi cho 2.2.0 về cơ bản liên quan đến việc đảm bảo rằng bạn sử dụng địa chỉ có thể truy cập và có thể truy cập cho tập hợp của mình vì 2.2.0 cố gắng tiếp cận ngay cả các phiên bản cục bộ trên mạng.

Các vấn đề liên quan