mongorestore Failed: no reachable servers
I tried to restore mongo from dump but failed:
mongorestore --port 27133 dump
2015-05-07T09:39:11.760+0300 Failed: no reachable servers
Although I can connect to it without any problem:
$ mongo --port 27133
MongoDB shell version: 3.0.1
connecting to: 127.0.0.1:27133/test
In a log file there is nothing special:
2015-05-07T09:37:00.350+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:44901 #1 (1 connection now open)
2015-05-07T09:37:13.935+0300 I NETWORK [conn1] end connection 127.0.0.1:44901 (0 connections now open)
2015-05-07T09:39:08.752+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:44906 #2 (1 connection now open)
2015-05-07T09:39:11.763+0300 I NETWORK [conn2] end connection 127.0.0.1:44906 (0 connections now open)
2015-05-07T09:39:52.365+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:44907 #3 (1 connection now open)
2015-05-07T09:39:55.064+0300 I NETWORK [conn3] end connection 127.0.0.1:44907 (0 connections now open)
2015-05-07T09:40:11.272+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:44909 #4 (1 connection now open)
2015-05-07T09:40:14.281+0300 I NETWORK [conn4] end connection 127.0.0.1:44909 (0 connections now open)
Update
Host 127.0.0.1
didn't help
$ mongorestore --host=127.0.0.1 --port=27132 dump
2015-12-16T18:52:33.270+0300 Failed: no reachable servers
Although I can still connect using mongo
command:
$ mongo --host=127.0.0.1 --port=27133
MongoDB shell version: 3.2.0
connecting to: 127.0.0.1:27133/test
> ^C
bye
Host 0.0.0.0
didn't help as well:
$ mongorestore --host=0.0.0.0 --port=27133 dump
I have 3.2 version of MongoDb:
$ mongorestore --version
mongorestore version: 3.2.0-rc5
git version: 6186100ad0500c122a56f0a0e28ce1227ca4fc88
try adding host param
mongorestore --host=127.0.0.1 --port=27133 dump
Do you run mongo in replica set, i.e., mongod --replSet rs0
?
If yes, please remember to run in your mongo shell the command: rs.initiate()
Then you can use cmd mongorestore
to restore your db.
The problem occured because --replSet
was enabled in configuration. But the node wasn't yet in any replica set.
After I removed --replSet
from configuration, relaunched mongodb server, mongorestore
started to work without any --host
parameter.