mongodb

作者: 003003 | 来源:发表于2019-03-29 16:32 被阅读0次

批量插入数据

mongo
use test
for (var i = 1; i <= 100000; i++) db.aaa.save({id:i,"name":"aaa8"});

查看

sh.status()  #查看分片集群信息
db.aaa.stats()   #查看表的信息
db.aaa.getShardDistribution()  #查看表的分片信息,数据分布

创建用户

db.createUser({user: 'admin', pwd: '123456', roles: [{role: 'root', db: 'admin'}]})

集群认证

openssl rand -base64 756 > /home/mongodb/KeyFile.file
chmod 400 /home/mongodb/KeyFile.file

#config shard1 shard2 shard3  增加以下配置
keyFile = /home/mongodb/KeyFile.file
auth = true

#mongos 增加以下配置
keyFile = /home/mongodb/KeyFile.file

相关文章

网友评论

      本文标题:mongodb

      本文链接:https://www.haomeiwen.com/subject/rkzlbqtx.html