数据库
首页 > 数据库> > MongoDB Could not find host matching read preference { mode: “primary” } for set shard1

MongoDB Could not find host matching read preference { mode: “primary” } for set shard1

作者:互联网

mongostat --discover --interactive --host 192.168.xx.xxx:27010
mongod -f /usr/local/mongodb/conf/config.conf
mongod -f /usr/local/mongodb/conf/shard.conf

shard和config服务终止

mongod -f /usr/local/mongodb/conf/config.conf --shutdown

mongos服务启动

mongos -f /usr/local/mongodb/conf/mongos.conf

mongos服务终止

# 进入mongos命令行
mongo --port 20000
use admin
db.auth('admin','admin.123')
db.shutdownServer()

注意:停止服务的顺序必须是先停止mongos服务,再停止其它服务。

参考链接:
https://blog.csdn.net/weixin_41715077/article/details/103148560
https://blog.csdn.net/moonshinewoo/article/details/103034014

标签:set,read,MongoDB,--,mongos,conf,mongodb,config,usr
来源: https://blog.csdn.net/qq_39045558/article/details/111867459