cannot get mongodb connected with scrapy-linkedin - mongodb

Mon Oct 31 18:40:34 [initandlisten] fd limit hard:1024 soft:1024 max conn: 819
Mon Oct 31 18:40:34 [initandlisten] waiting for connections on port 27017
Mon Oct 31 18:40:34 BackgroundJob starting: snapshot
Mon Oct 31 18:40:34 BackgroundJob starting: ClientCursorMonitor
Mon Oct 31 18:40:34 BackgroundJob starting: PeriodicTask::Runner
Mon Oct 31 18:40:34 [websvr] fd limit hard:1024 soft:1024 max conn: 819
Mon Oct 31 18:40:34 [websvr] admin web console waiting for connections on port 28017
the command prompt gets hung up for so much time as i start mongod.exe
i have made the directory data\db as well
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/#mongodb-as-a-windows-service

Related

MongoDB suddenly won't start

I have been running MongoDB on a RPI for several weeks, and suddenly it won't start. I know there's a lot of similar questions where correcting the permissions seemed to work. However, this has not worked for me.
I suspect a power off of the RPI has caused this problem, but I have no idea how to solve it.
I get the following terminal output:
$ sudo service mongodb start
[FAIL] Starting database: mongodb failed!
More details are shown with the 'mongod' command:
$ mongod
db level locking enabled: 1
mongod --help for help and startup options
Fri Aug 28 14:04:06
Fri Aug 28 14:04:06 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Fri Aug 28 14:04:06
Fri Aug 28 14:04:06 [initandlisten] MongoDB starting : pid=4036 port=27017 dbpath=/data/db/ 32-bit host=raspberrypi
Fri Aug 28 14:04:06 [initandlisten]
Fri Aug 28 14:04:06 [initandlisten] ** NOTE: This is a development version (2.1.1) of MongoDB.
Fri Aug 28 14:04:06 [initandlisten] ** Not recommended for production.
Fri Aug 28 14:04:06 [initandlisten]
Fri Aug 28 14:04:06 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Fri Aug 28 14:04:06 [initandlisten] ** see http://blog.mongodb.org/post/137788967/32-bit-limitations
Fri Aug 28 14:04:06 [initandlisten] ** with --journal, the limit is lower
Fri Aug 28 14:04:06 [initandlisten]
Fri Aug 28 14:04:06 [initandlisten] db version v2.1.1, pdfile version 4.5
Fri Aug 28 14:04:06 [initandlisten] git version: f457ff42ec37f2562d1a5ff06b4d96a861414c94
Fri Aug 28 14:04:06 [initandlisten] build info: Linux piplusraspbian 3.12.22+ #691 PREEMPT Wed Jun 18 18:29:58 BST 2014 armv6l BOOST_LIB_VERSION=1_49
Fri Aug 28 14:04:06 [initandlisten] options: {}
Fri Aug 28 14:04:06 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
Fri Aug 28 14:04:06 dbexit:
Fri Aug 28 14:04:06 [initandlisten] shutdown: going to close listening sockets...
Fri Aug 28 14:04:06 [initandlisten] shutdown: going to flush diaglog...
Fri Aug 28 14:04:06 [initandlisten] shutdown: going to close sockets...
Fri Aug 28 14:04:06 [initandlisten] shutdown: waiting for fs preallocator...
Fri Aug 28 14:04:06 [initandlisten] shutdown: closing all files...
Fri Aug 28 14:04:06 [initandlisten] closeAllFiles() finished
Fri Aug 28 14:04:06 [initandlisten] shutdown: removing fs lock...
Fri Aug 28 14:04:06 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
Fri Aug 28 14:04:06 dbexit: really exiting now
The /data/db does exist and seem to have the right permission:
$ ls -l /data
total 8
drwxr-xr-x 2 mongodb mongodb 4096 Aug 28 14:37 db
drwxr-xr-x 4 mongodb mongodb 4096 Aug 28 09:44 db_backup
The content of db has been copied to db_backup to check if that did any change, but it didn't. The db content permissions also seem fine:
$ ls -l /data/db_backup
total 131100
drwxr-xr-x 2 mongodb mongodb 4096 Aug 28 09:44 client-db
-rw------- 1 mongodb mongodb 16777216 Aug 28 09:44 client-db.0
-rw------- 1 mongodb mongodb 33554432 Aug 28 09:44 client-db.1
-rw------- 1 mongodb mongodb 16777216 Aug 28 09:44 client-db.ns
-rwxr-xr-x 1 mongodb mongodb 0 Aug 28 13:52 mongod.lock
drwxr-xr-x 2 mongodb mongodb 4096 Aug 28 09:44 myproject
-rw------- 1 mongodb mongodb 16777216 Aug 28 09:44 myproject.0
-rw------- 1 mongodb mongodb 33554432 Aug 28 09:44 myproject.1
-rw------- 1 mongodb mongodb 16777216 Aug 28 09:44 myproject.ns
I have also tried mongod --repair, but it does not help.
Does anyone have any ideas?
I don't care about the data, as it is all just temporary testing data.
There is a mongod.lock file inside the mongo's data directory, normally is /var/lib/mongodb. The content of this file is the pid of the mongod process.
If the mongod is stopped, the content of this file should be empty. Otherwise the mongod was stopped unexpectedly. To fix and start a new mongod process, assuming that mongo's data directory is /var/lib/mongodb. Just clear the file...
$ echo "" > /var/lib/mongodb/mongod.lock
and start a new mongod process.
$ mongod

Mongo Crashes Periodically

We have a 3-node replicaSet that periodically crashes and is unable to recover. Looking through our PRIMARY server's mongod.log file, I see multiple errors. I'm not sure where to begin or even what to include in this post but I'll start with the errors I am receiving. If I'm missing something, please let me know and I'll edit the post and include it. Can anyone shed any light on why this is happening?
Thu Feb 27 14:09:47.790 [rsSyncNotifier] replset tracking exception: exception: 10278 dbclient error communicating with server: mongos2i.hostname.com:27017
Thu Feb 27 14:09:47.790 [rsBackgroundSync] replSet sync source problem: 10278 dbclient error communicating with server: mongos2i.hostname.com:27017
Thu Feb 27 14:09:47.790 [rsBackgroundSync] replSet syncing to: mongos2i.hostname.com:27017
Thu Feb 27 14:09:47.791 [rsBackgroundSync] repl: couldn't connect to server mongos2i.hostname.com:27017
Thu Feb 27 14:09:47.792 [conn152] end connection xx.xxx.xxx.107:43904 (71 connections now open)
Thu Feb 27 14:09:48.077 [rsHealthPoll] DBClientCursor::init call() failed
Thu Feb 27 14:09:48.077 [rsHealthPoll] replset info mongos2i.hostname.com:27017 heartbeat failed, retrying
Thu Feb 27 14:09:48.078 [rsHealthPoll] replSet info mongos2i.hostname.com:27017 is down (or slow to respond):
Thu Feb 27 14:09:48.078 [rsHealthPoll] replSet member mongos2i.hostname.com:27017 is now in state DOWN
Thu Feb 27 14:09:48.080 [rsMgr] not electing self, mongos1i.hostname.com:27017 would veto with 'mongom1i.hostname.com:27017 is trying to elect itself but mongos2i.hostname.com:27017 is already primary and more up-to-date'
Thu Feb 27 14:09:49.079 [conn153] replSet info voting yea for mongos1i.hostname.com:27017 (1)
Thu Feb 27 14:09:50.080 [rsHealthPoll] replSet member mongos1i.hostname.com:27017 is now in state PRIMARY
Thu Feb 27 14:09:50.081 [rsHealthPoll] replSet member mongos2i.hostname.com:27017 is up
Thu Feb 27 14:09:50.082 [initandlisten] connection accepted from xx.xxx.xxx.107:43907 #154 (72 connections now open)
Thu Feb 27 14:09:50.082 [conn154] end connection xx.xxx.xxx.107:43907 (71 connections now open)
Thu Feb 27 14:09:50.086 [initandlisten] connection accepted from xx.xxx.xxx.107:43909 #155 (72 connections now open)
Thu Feb 27 14:09:50.792 [rsBackgroundSync] replSet syncing to: mongos1i.hostname.com:27017
Thu Feb 27 14:09:52.082 [rsHealthPoll] replSet member mongos2i.hostname.com:27017 is now in state SECONDARY
Thu Feb 27 14:10:04.090 [conn155] end connection xx.xxx.xxx.107:43909 (71 connections now open)
Thu Feb 27 14:10:04.091 [initandlisten] connection accepted from xx.xxx.xxx.107:43913 #156 (72 connections now open)
Thu Feb 27 14:10:10.731 [conn153] end connection xx.xxx.xxx.97:52297 (71 connections now open)
Thu Feb 27 14:10:10.732 [initandlisten] connection accepted from xx.xxx.xxx.97:52302 #157 (72 connections now open)
Thu Feb 27 14:10:29.706 [initandlisten] connection accepted from 127.0.0.1:56436 #158 (73 connections now open)
Thu Feb 27 14:10:34.100 [conn156] end connection xx.xxx.xxx.107:43913 (72 connections now open)
Thu Feb 27 14:10:34.101 [initandlisten] connection accepted from xx.xxx.xxx.107:43916 #159 (73 connections now open)
Thu Feb 27 14:10:40.743 [conn157] end connection xx.xxx.xxx.97:52302 (72 connections now open)
Thu Feb 27 14:10:40.744 [initandlisten] connection accepted from xx.xxx.xxx.97:52309 #160 (73 connections now open)
Thu Feb 27 14:11:04.110 [conn159] end connection xx.xxx.xxx.107:43916 (72 connections now open)
Thu Feb 27 14:11:04.111 [initandlisten] connection accepted from xx.xxx.xxx.107:43918 #161 (73 connections now open)
Thu Feb 27 14:11:09.191 [conn161] end connection xx.xxx.xxx.107:43918 (72 connections now open)
Thu Feb 27 14:11:09.452 [initandlisten] connection accepted from xx.xxx.xxx.107:43919 #162 (73 connections now open)
Thu Feb 27 14:11:09.453 [conn162] end connection xx.xxx.xxx.107:43919 (72 connections now open)
Thu Feb 27 14:11:09.456 [initandlisten] connection accepted from xx.xxx.xxx.107:43921 #163 (73 connections now open)
Thu Feb 27 14:11:10.111 [rsHealthPoll] DBClientCursor::init call() failed
Thu Feb 27 14:11:10.111 [rsHealthPoll] replset info mongos2i.hostname.com:27017 heartbeat failed, retrying
Thu Feb 27 14:11:10.113 [rsHealthPoll] replSet member mongos2i.hostname.com:27017 is now in state STARTUP2
Thu Feb 27 14:11:10.755 [conn160] end connection xx.xxx.xxx.97:52309 (72 connections now open)
Thu Feb 27 14:11:10.757 [initandlisten] connection accepted from xx.xxx.xxx.97:52311 #164 (73 connections now open)
Thu Feb 27 14:11:12.113 [rsHealthPoll] replSet member mongos2i.hostname.com:27017 is now in state SECONDARY
Thu Feb 27 14:11:23.462 [conn163] end connection xx.xxx.xxx.107:43921 (72 connections now open)
Thu Feb 27 14:11:23.463 [initandlisten] connection accepted from xx.xxx.xxx.107:43925 #165 (73 connections now open)
Thu Feb 27 14:11:31.831 [conn158] end connection 127.0.0.1:56436 (72 connections now open)
Thu Feb 27 14:11:40.768 [conn164] end connection xx.xxx.xxx.97:52311 (71 connections now open)
Thu Feb 27 14:11:40.769 [initandlisten] connection accepted from xx.xxx.xxx.97:52315 #166 (72 connections now open)
Thu Feb 27 14:11:53.082 [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
Thu Feb 27 14:11:53.082 [signalProcessingThread] now exiting
Thu Feb 27 14:11:53.082 dbexit:
We are using CentOS and Mongo 2.4.9.
Thanks in advance for the help.
The log output you have posted shows that your MongoDB instance did not crash. It exited normally.
Consider the following lines:
Thu Feb 27 14:11:53.082 [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
Thu Feb 27 14:11:53.082 [signalProcessingThread] now exiting
Thu Feb 27 14:11:53.082 dbexit:
The first line above indicates that your MongoDB instancce recieved signal 15 from your OS (SIGTERM). This lead to MongoDB terminating. SIGTERM is the default level for the kill command and for stop portion of an init script in most Linux distros.

Start mongo failed

I get an error when I try to start mongo using the "mongod" command (on Macintosh).
all output going to: /usr/local/var/log/mongodb/mongo.log
My logs :
***** SERVER RESTARTED *****
Tue Oct 29 13:15:48.783 [initandlisten] MongoDB starting : pid=859 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=MacBook-Pro-de-Anthony
Tue Oct 29 13:15:48.784 [initandlisten] db version v2.4.4
Tue Oct 29 13:15:48.784 [initandlisten] git version: 4ec1fb96702c9d4c57b1e06dd34eb73a16e407d2
Tue Oct 29 13:15:48.784 [initandlisten] build info: Darwin bs-osx-106-x86-64-2.10gen.cc 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
Tue Oct 29 13:15:48.784 [initandlisten] allocator: system
Tue Oct 29 13:15:48.784 [initandlisten] options: { bind_ip: "127.0.0.1", config: "/usr/local/etc/mongod.conf", dbpath: "/usr/local/var/mongodb", logappend: "true", logpath: "/usr/local/var/log/mongodb/mongo.log" }
Tue Oct 29 13:15:48.784 [initandlisten] journal dir=/usr/local/var/mongodb/journal
Tue Oct 29 13:15:48.784 [initandlisten] recover : no journal files present, no recovery needed
Tue Oct 29 13:15:48.801 [initandlisten] ERROR: listen(): bind() failed errno:48 Address already in use for socket: 127.0.0.1:27017
Tue Oct 29 13:15:48.801 [websvr] ERROR: listen(): bind() failed errno:48 Address already in use for socket: 127.0.0.1:28017
Tue Oct 29 13:15:48.801 [initandlisten] ERROR: addr already in use
Tue Oct 29 13:15:48.801 [websvr] ERROR: addr already in use
Tue Oct 29 13:15:48.801 [initandlisten] now exiting
Tue Oct 29 13:15:48.801 dbexit:
Tue Oct 29 13:15:48.801 [initandlisten] shutdown: going to close listening sockets...
Tue Oct 29 13:15:48.801 [initandlisten] shutdown: going to flush diaglog...
Tue Oct 29 13:15:48.801 [initandlisten] shutdown: going to close sockets...
Tue Oct 29 13:15:48.801 [initandlisten] shutdown: waiting for fs preallocator...
Tue Oct 29 13:15:48.801 [initandlisten] shutdown: lock for final commit...
Tue Oct 29 13:15:48.801 [initandlisten] shutdown: final commit...
Tue Oct 29 13:15:48.802 [initandlisten] shutdown: closing all files...
Tue Oct 29 13:15:48.802 [initandlisten] closeAllFiles() finished
Tue Oct 29 13:15:48.802 [initandlisten] journalCleanup...
Tue Oct 29 13:15:48.802 [initandlisten] removeJournalFiles
Tue Oct 29 13:15:48.803 [initandlisten] shutdown: removing fs lock...
Tue Oct 29 13:15:48.803 dbexit: really exiting now
UPDATE:
When I execute the "mongo" command :
MacBook-Pro-de-Anthony:Sites anthonycluse$ mongo
MongoDB shell version: 2.4.4
connecting to: test
Server has startup warnings:
Tue Oct 29 11:43:15 [initandlisten]
Tue Oct 29 11:43:15 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
> show dbs;
anthonycluse (empty)
local (empty)
>
It means that the username is "test" no?
UPDATE 2 :
The "show users;" command :
MacBook-Pro-de-Anthony:Sites anthonycluse$ mongo
MongoDB shell version: 2.4.4
connecting to: test
Server has startup warnings:
Tue Oct 29 11:43:15 [initandlisten]
Tue Oct 29 11:43:15 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
> show users;
>
Is there another process listening on those ports? Try finding out with:
netstat -tulpen | grep 017 # 017 for both port 27017 and 28017
Kill that process if you're sure you don't need it. As answered below by Lix, there may already be a mongo process running.
The answer is right there in side the log file:
Tue Oct 29 13:15:48.801 [websvr] ERROR: listen(): bind() failed errno:48 Address already in use for socket: 127.0.0.1:28017
Specifically this part: "Address already in use for socket: 127.0.0.1:28017"
It seems that there is already a mongo instance running on that default port 27017. It might not even be a mongo instance but some other application that is using that port.
As per the logs it is clear that there is another mongodb instance running on default, i believe you installed mongodb using rpm and started this service using service mongodb start. so when the server restarts by default it starts some of the services, using defaultconfiguration which will be avialble in /etc/mongod.config edit this file or stop the one which is running already so you can avoid the mongod default instamce and made ur version to up and running

Mongodb gives error during startup

Whenever I try to play with mongo's interactive shell, it dies:
somekittens#DLserver01:~$ mongo
MongoDB shell version: 2.2.2
connecting to: test
Mon Dec 17 13:14:16 DBClientCursor::init call() failed
Mon Dec 17 13:14:16 Error: Error during mongo startup. :: caused by :: 10276 DBClientBase::findN: transport error: 127.0.0.1:27017 ns: admin.$cmd query: { whatsmyuri: 1 } src/mongo/shell/mongo.js:91
exception: connect failed
I'm able to repair the install (deleting mongodb.lock, etc) and get back to this point, but it'll only die again.
/var/log/mongodb/mongodb.log
Mon Dec 17 13:14:03
Mon Dec 17 13:14:03 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Mon Dec 17 13:14:03
Mon Dec 17 13:14:03 [initandlisten] MongoDB starting : pid=2674 port=27017 dbpath=/var/lib/mongodb 32-bit host=DLserver01
Mon Dec 17 13:14:03 [initandlisten]
Mon Dec 17 13:14:03 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Mon Dec 17 13:14:03 [initandlisten] ** see http://blog.mongodb.org/post/137788967/32-bit-limitations
Mon Dec 17 13:14:03 [initandlisten] ** with --journal, the limit is lower
Mon Dec 17 13:14:03 [initandlisten]
Mon Dec 17 13:14:03 [initandlisten] db version v2.2.2, pdfile version 4.5
Mon Dec 17 13:14:03 [initandlisten] git version: d1b43b61a5308c4ad0679d34b262c5af9d664267
Mon Dec 17 13:14:03 [initandlisten] build info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_49
Mon Dec 17 13:14:03 [initandlisten] options: { config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" }
Mon Dec 17 13:14:03 [initandlisten] Unable to check for journal files due to: boost::filesystem::basic_directory_iterator constructor: No such file or directory: "/var/lib/mongodb/journal"
Mon Dec 17 13:14:03 [initandlisten] couldn't unlink socket file /tmp/mongodb-27017.sockerrno:1 Operation not permitted skipping
Mon Dec 17 13:14:03 [initandlisten] waiting for connections on port 27017
Mon Dec 17 13:14:03 [websvr] admin web console waiting for connections on port 28017
Mon Dec 17 13:14:16 [initandlisten] connection accepted from 127.0.0.1:57631 #1 (1 connection now open)
Mon Dec 17 13:14:16 Invalid operation at address: 0x819bb23 from thread: conn1
Mon Dec 17 13:14:16 Got signal: 4 (Illegal instruction).
Mon Dec 17 13:14:16 Backtrace:
0x8759eaa 0x817033a 0x81709ff 0x20e40c 0x819bb23 0x854cd54 0x85377d1 0x846b594 0x83e5591 0x83e6c15 0x81902b4 0x8746731 0x49ad4c 0x34ed3e
/usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x2a) [0x8759eaa]
/usr/bin/mongod(_ZN5mongo10abruptQuitEi+0x3ba) [0x817033a]
/usr/bin/mongod(_ZN5mongo24abruptQuitWithAddrSignalEiP7siginfoPv+0x2af) [0x81709ff]
[0x20e40c]
/usr/bin/mongod(_ZNK5mongo7BSONObj4copyEv+0x33) [0x819bb23]
/usr/bin/mongod(_ZN5mongo11ParsedQuery4initERKNS_7BSONObjE+0x494) [0x854cd54]
/usr/bin/mongod(_ZN5mongo11ParsedQueryC1ERNS_12QueryMessageE+0x91) [0x85377d1]
/usr/bin/mongod(_ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_+0x34) [0x846b594]
/usr/bin/mongod() [0x83e5591]
/usr/bin/mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x3d5) [0x83e6c15]
/usr/bin/mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x84) [0x81902b4]
/usr/bin/mongod(_ZN5mongo3pms9threadRunEPNS_13MessagingPortE+0x421) [0x8746731]
/lib/i386-linux-gnu/libpthread.so.0(+0x6d4c) [0x49ad4c]
/lib/i386-linux-gnu/libc.so.6(clone+0x5e) [0x34ed3e]
Connecting using node's shell:
> mdb.open(function(err, db) { console.log(err) });
[Error: failed to connect to [localhost:27017]]
I've searched around for this error and found nothing of use. This is running on a fairly old server (Ubuntu 12.04 32-bit, 640MB RAM, 500MHz P2). How can I fix this?
There is an issue Invalid operation at address: 0x819b263 from thread: TTLMonitor in mongodb jira list. I think that is about your case.
A new server may be the easiest solution, otherwise you have to download the source code, make some modification and compile it youself.

How can I fix "EMPTYUNREACHABLE" on deploying a test replset on my mac?

I'm trying to deploy a development/test replication set on my macbook pro using this document.
http://docs.mongodb.org/manual/tutorial/deploy-replica-set/
I started 3 instances of mongod, each on port 10001, 10002, 10003
I used the configuration file to start mongod. The configuration file below:
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
And using the following command to start:
mongod -f config/rs0.conf
mongod -f config/rs1.conf
mongod -f config/rs2.conf
then I connect to it using mongo: mongo localhost:10001, but when I use rs.initiate() command to initialize the repl set, it failed.
> rs.initiate()
{
"startupStatus" : 4,
"info" : "rs0",
"errmsg" : "all members and seeds must be reachable to initiate set",
"ok" : 0
}
and check by rs.status()
> rs.status()
{
"startupStatus" : 4,
"errmsg" : "can't currently get local.system.replset config from self or any seed (EMPTYUNREACHABLE)",
"ok" : 0
}
And the log shows it's a EMPTYUNREACHABLE error. how could solve it?
***** 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)
Try setting bind_ip to 127.0.0.1 or add an entry for `bogon' to your /etc/hosts?
mongodb appears to be getting the hostname() for the local system but it’s not resolvable.
I faced the exact issue today. I was able to start mongodb but not the replica sets. I had to delete the following line from the mongod.conf file
'bind_ip: "127.0.0.1"'
I also figured out that the mongod.conf files for mongodb and replica sets were different and stored at different locations, maybe because I brew installed the latest version of mongodb?. I found my replica set config file at "/usr/local/etc/mongod.conf".
FYI, I believe you hit this bug in 2.2.0:
https://jira.mongodb.org/browse/SERVER-7367
It is now fixed and scheduled for release in 2.2.1 - the fixes for 2.2.0 basically involve making sure that you use resolvable and reachable addresses for your sets because 2.2.0 tries to reach even local instances over the network.