first commit

This commit is contained in:
light
2017-05-19 11:14:30 +08:00
parent d194b5f2eb
commit e1865a5782
14 changed files with 1335 additions and 1 deletions
+30
View File
@@ -0,0 +1,30 @@
# config the root role of mongodb
refer to http://www.server110.com/mongodb/201705/89462.html
``` bash
$ mongo
> show dbs
> use admin
> db.createUser({
user: "light",
pwd: "123456",
roles: [ { role: "userAdminAnyDatabase", db: "admin" }]
}
)
```
# role
1. 数据库用户角色:read、readWrite;
2. 数据库管理角色:dbAdmin、dbOwner、userAdmin
3. 集群管理角色:clusterAdmin、clusterManager、clusterMonitor、hostManager
4. 备份恢复角色:backup、restore
5. 所有数据库角色:readAnyDatabase、readWriteAnyDatabase、userAdminAnyDatabase、dbAdminAnyDatabase
6. 超级用户角色:root
// 这里还有几个角色间接或直接提供了系统超级用户的访问(dbOwner 、userAdmin、userAdminAnyDatabase
7. 内部角色:__system
add this config into /etc/mongod.config
``` bash
security:
authorization: enabled
```