mongorestore Failed: no reachable servers

后端 未结 12 1712
天涯浪人
天涯浪人 2020-12-15 03:06

I tried to restore mongo from dump but failed:

mongorestore --port 27133 dump
2015-05-07T09:39:11.760+0300    Failed: no reachable servers

相关标签:
12条回答
  • 2020-12-15 03:52

    I had difficulty with that question also.

    mongorestore --host f8cab83e7294 --port 27601 gene_backup_final/gene_backup/s2/  --verbose
    
    2016-12-05T13:48:15.333-0700 Failed: error connecting to db server: no reachable servers
    

    I failed to initiate the replica set. That is why there was no reachable server

    After initiating the RS, restore worked.

    mongo localhost:27501
    rs.initiate()
    
    0 讨论(0)
  • 2020-12-15 03:53

    try adding host param

    mongorestore --host=127.0.0.1 --port=27133 dump
    
    0 讨论(0)
  • 2020-12-15 03:53

    I have MongoDB installed through Homebrew, and was having this issue. Here are the symptoms:

    These failed:

    mongorestore dump

    mongorestore dump --host=localhost

    The error I got: Failed: error connecting to db server: no reachable servers

    These worked (as a workaround):

    mongorestore dump --host=127.0.0.1

    mongorestore dump --host=0.0.0.0

    This fixed the problem for me:

    brew update && brew upgrade

    That updated MongoDB to 3.0.7 and now mongorestore dump works without the host flag.

    0 讨论(0)
  • 2020-12-15 03:54

    In my case, I am defining port two times.

    mongorestore --noIndexRestore --host X.X.X.X:27017 -d XYZ --port 27017 foldername

    Solve in my case,

    mongorestore --noIndexRestore --host X.X.X.X -d XYZ --port 27017 foldername

    0 讨论(0)
  • 2020-12-15 03:58

    check your mongod configuration file, if you have enabled replication disable it, if enabled, key based authentication disable it basically disable every other thing and restart the mongod service and then try doing mongo restore.

    And BTW, try binding mongod ipaddress to your machine address as well, if it is a local mongod instance try binding the ip address to 0.0.0.0, in mongod.conf file under bind_ip="your ip address", do let me know it does or does not.

    0 讨论(0)
  • 2020-12-15 04:00

    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.

    0 讨论(0)
提交回复
热议问题