没有检测到集[Mongo shell]的主要内容

时间:2017-10-20 15:14:44

标签: mongodb shell mongo-shell

我目前的MongoDb版本是3.2.7 我正在尝试使用此

连接到我的数据库
"mongo mongodb://meanbeta-shard-00-00-sshqm.mongodb.net:27017,meanbeta-shard-00-01-sshqm.mongodb.net:27017,meanbeta-shard-00-02-sshqm.mongodb.net:27017/test?replicaSet=MEANbeta-shard-0" --authenticationDatabase admin --ssl --username xxxx --password xxxxx

昨天我能够通过mongo shell连接,但今天它给了我错误,但我仍然能够使用Compass App进行连接:

 
  2017-10-20T20:34:04.682+0530 I NETWORK  [thread1] Starting new replica set monitor for MEANbeta-shard-0/meanbeta-shard-00-00-sshqm.mongodb.net:27017,meanbeta-shard-00-01-sshqm.mongodb.net:27017,meanbeta-shard-00-02-sshqm.mongodb.net:27017
2017-10-20T20:34:04.682+0530 I NETWORK  [ReplicaSetMonitorWatcher] starting
2017-10-20T20:34:07.708+0530 W NETWORK  [thread1] No primary detected for set MEANbeta-shard-0
2017-10-20T20:34:11.095+0530 W NETWORK  [thread1] No primary detected for set MEANbeta-shard-0
2017-10-20T20:34:14.516+0530 W NETWORK  [thread1] No primary detected for set MEANbeta-shard-0
2017-10-20T20:34:16.637+0530 W NETWORK  [ReplicaSetMonitorWatcher] No primary detected for set MEANbeta-shard-0
2017-10-20T20:34:20.056+0530 W NETWORK  [thread1] No primary detected for set MEANbeta-shard-0
2017-10-20T20:34:20.056+0530 E QUERY    [thread1] Error: connect failed to replica set MEANbeta-shard-0/meanbeta-shard-00-00-sshqm.mongodb.net:27017,meanbeta-shard-00-01-sshqm.mongodb.net:27017,meanbeta-shard-00-02-sshqm.mongodb.net:27017 :
 

我是MongoDB及其副本集概念的新手,请帮助我。

谢谢

2 个答案:

答案 0 :(得分:3)

不要从apt-get安装mongo shell,因为它安装了旧版本。您需要 MongoDB shell版本v3.4.10 或更高版本才能工作。

在我从mongo网站连接到群集对话框中显示的链接安装新版本之前,我也遇到了同样的问题。

enter image description here

答案 1 :(得分:0)

感谢@Natesh,

echo 'http://dl-cdn.alpinelinux.org/alpine/v3.8/main' >> /etc/apk/repositories && \
echo 'http://dl-cdn.alpinelinux.org/alpine/v3.8/community' >> /etc/apk/repositories && \
apk update && \
apk add mongodb=3.6.7-r0 && \
mongo --version 

为我工作。