mongodb Failed: error connecting to db server: no reachable servers

前端 未结 12 2047
失恋的感觉
失恋的感觉 2020-12-13 11:59

I installed mongodb in Ubuntu14.04 server

I was not able to connect to mongodb via \"mongoimport\", \"mongodump\", \"mongostat\", etc. It always show \"no reachable

12条回答
  •  没有蜡笔的小新
    2020-12-13 12:46

    Adding another answer for those who are struggling with the same issue while using MongoDB Atlas.

    I tried to follow the offical guides like Seed with mongorestore and Load File with mongoimport but received the same no reachable servers error.

    I tried to change the command arguments over and over - nothing changed.

    But then I navigated inside my cluster to the "Command Line Tools" tab and saw the exact command I should run for mongorestore, mongodump, mongoimport,mongoexport etc':

    Adding as inline the full command:

    mongorestore --host 
    -shard-0/
    -shard-00-00-obe3i.mongodb.net:27017,
    -shard-00-01-obe3i.mongodb.net:27017,
    -shard-00-02-obe3i.mongodb.net:27017 
    --ssl 
    --username  
    --password  
    --authenticationDatabase admin 
    

    The mongorestore comand can be replaced with mongodump,mongoimport,mongoexport etc'.

    (*) Prefer copying the command directly from dashboard because the DNS of the replica-sets might change.

    (**) MongoDB shell version v4.2.5.

提交回复
热议问题