configsvr> use config
configsvr> db.databases.find() #查看数据库信息
configsvr> db.collections.find() #查看集合信息
configsvr> db.chunks.find() #查看数据块信息
[root@localhost ~]# vim /etc/mongodb4.conf
port=47019
dbpath=/usr/local/mongodb/data/mongodb4
logpath=/usr/local/mongodb/log/mongodb4.log
logappend=true
fork=true
maxConns=5000
storageEngine=mmapv1
shardsvr=true
[root@localhost ~]# /etc/init.d/mongodb mongodb4 start #启动第4个实例
[root@localhost ~]# mongo --port 27017
mongos> sh.addShard("192.168.100.77:47019") #添加分片
mongos> sh.status()
[root@localhost ~]# mongo --port 27017
mongos> use admin
mongos> db.runCommand({"removeshard":"192.168.100.77:47019"})
mongos> sh.status()
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx