我創建了一個mongodb集羣並嘗試通過mongo shell進行連接,但出現錯誤。我在做什麼不對?Mongodb連接失敗
mongo "mongodb://cluster0-shard-00-00-qvc6m.mongodb.net:27017,cluster0-shard-00-01-qvc6m.mongodb.net:27017,cluster0-shard-00-02-qvc6m.mongodb.net:27017/test?replicaSet=cluster0-shard-0" --authenticationDatabase <DATABASE> --ssl --username <USERNAME> --password <PASSWORD>
MongoDB shell version: 3.2.12
connecting to: mongodb://cluster0-shard-00-00-qvc6m.mongodb.net:27017,cluster0-shard-00-01-qvc6m.mongodb.net:27017,cluster0-shard-00-02-qvc6m.mongodb.net:27017/test?replicaSet=cluster0-shard-0
2017-06-02T18:59:22.341+0530 I NETWORK [thread1] Starting new replica set monitor for cluster0-shard-0/cluster0-shard-00-00-qvc6m.mongodb.net:27017,cluster0-shard-00-01-qvc6m.mongodb.net:27017,cluster0-shard-00-02-qvc6m.mongodb.net:27017
2017-06-02T18:59:22.342+0530 I NETWORK [ReplicaSetMonitorWatcher] starting
2017-06-02T18:59:27.220+0530 W NETWORK [thread1] No primary detected for set cluster0-shard-0
2017-06-02T18:59:28.685+0530 W NETWORK [thread1] No primary detected for set cluster0-shard-0
2017-06-02T18:59:30.120+0530 W NETWORK [thread1] No primary detected for set cluster0-shard-0
2017-06-02T18:59:31.553+0530 W NETWORK [thread1] No primary detected for set cluster0-shard-0
2017-06-02T18:59:32.679+0530 W NETWORK [ReplicaSetMonitorWatcher] No primary detected for set cluster0-shard-0
2017-06-02T18:59:34.072+0530 W NETWORK [thread1] No primary detected for set cluster0-shard-0
2017-06-02T18:59:35.546+0530 W NETWORK [thread1] No primary detected for set cluster0-shard-0
2017-06-02T18:59:36.981+0530 W NETWORK [thread1] No primary detected for set cluster0-shard-0
2017-06-02T18:59:36.981+0530 E QUERY [thread1] Error: connect failed to replica set cluster0-shard-0/cluster0-shard-00-00-qvc6m.mongodb.net:27017,cluster0-shard-00-01-qvc6m.mongodb.net:27017,cluster0-shard-00-02-qvc6m.mongodb.net:27017 :
[email protected]/mongo/shell/mongo.js:223:14
@(connect):1:6
exception: connect failed
在此先感謝。
那麼原因是錯誤'沒有主的一套cluster0-碎片-0'檢測。所以複製品可能處於選舉狀態。你需要看看,看看是什麼造成了**這個特殊問題。 –
順便說一句。關於爲什麼副本集沒有主節點的新問題是StackOverflow的「脫離主題」,因爲它是關於配置數據庫的。 [dba.stackexchange.com](https://dba.stackexchange.com)是你可以問的地方。 –
@ Neil Lunn:感謝您的建議 – rahulb