js
root@test-192:~# helm search repo mongodb
NAME CHART VERSION APP VERSION DESCRIPTION
bitnami/mongodb 14.0.12 7.0.2 MongoDB(R) is a relational open source NoSQL da...
bitnami/mongodb-sharded 7.0.5 7.0.2 MongoDB(R) is an open source NoSQL database tha...
#修改后存储和副本直接运行
helm install mongodb bitnami/mongodb-sharded --values values.yaml
#将分片的数量设置为 5
操作
js
mongosh mongodb://root:123000@sport-mongodb-sharded:27017/admin
# 创建数据库
use sport_sit;
# 创建sport数据库下的用户
db.createUser(
{
user: "sport00",
pwd: "12300",
roles: [ "readWrite" ]
}
);
js
mongosh mongodb://sport-mongodb-sharded:27017/admin
mongosh 工具,则可以使用以下命令来验证用户身份:
use admin
db.auth("myuser", "mypassword")
db.createUser({user:"sport01",pwd:"123000",roles:["readWrite"]})
db.createCollection('sport');