如果mongodb实例启用了验证,那么MMS的监控代理和备份代理就要求验证并对其授予应有的权限。
mongodb admin数据库定义所有用户账号。文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
本节主要正对mongodb2.4和mongodb2.6版本来说的。文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
MMS 监控
MongoDB 2.6
监控mongodb2.6实例,代理用户必需要有clusterMonitor角色。文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
use admin db.createUser( { user: "<username>", pwd: "<password>", roles: [ { role: "clusterMonitor", db: "admin" } ] } )
此外,为了与2.4版本兼容,代理可能尝试查询local数据库。只授予clusterMonitor 角色,mongodb日志中会产生验证错误的信息,代理可以从这个错误中恢复,可以放心地忽略这些消息。文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
MongoDB 2.4
要监控mongodb2.4实例,代理用户必需要以下权限:文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
- clusterAdmin
- readAnyDatabase
use admin db.addUser( { user: "<username>", pwd: "<password>", roles: [ "clusterAdmin", "readAnyDatabase" ] } )
因为基本监控用户不需要dbAdminAnyDatabase 角色,mongodb日志可能会报告下面的信息:command denied: { profile: -1 }。文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
如果不希望MMS收集profile数据,可以忽略该信息。如果需要收集,就赋予该权限。文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
MMS Monitoring with Database Profiling
Profiling 可以捕获正在进行的读写操作,cursor 操作和有关数据库的数据库命令的信息。文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
MongoDB 2.6
带数据库profiling监控2.6版本需要clusterMonitor 角色权限。文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
use admin db.createUser( { user: "<username>", pwd: "<password>", roles: [ { role: "clusterMonitor", db: "admin" } ] } )
MongoDB 2.4
带数据库profiling监控2.4版本需要以下角色权限:文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
- clusterAdmin
- readAnyDatabase
- dbAdminAnyDatabase
use admin db.addUser( { user: "<username>", pwd: "<password>", roles: [ "clusterAdmin", "readAnyDatabase", "dbAdminAnyDatabase" ] } )
MMS Monitoring without dbStats
监控没有dbStats会产生监控数据没有数据库存储,记录,索引和其他数据的统计。也就是不会收集到dbStats下的数据。文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
MongoDB 2.6
clusterMonitor 角色包含执行dbStats操作的权限。文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
use admin db.createUser( { user: "<username>", pwd: "<password>", roles: [ { role: "clusterMonitor", db: "admin" } ] } )
MongoDB 2.4
监控2.4版本需要clusterAdmin 角色权限。文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
use admin db.addUser( { user: "<username>", pwd: "<password>", roles: [ "clusterAdmin" ] } )
MMS 备份
MongoDB 2.6
要备份的MongoDB2.6实例,备份代理需要以下权限:文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
- clusterAdmin
- readAnyDatabase
- userAdminAnyDatabase
同时,还需要以下的角色:文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
- readWrite 对local库的角色
- readWrite 对admin库的角色
use admin db.createUser( { user: "<username>", pwd: "<password>", roles: [ "clusterAdmin", "readAnyDatabase", "userAdminAnyDatabase", { role: "readWrite", db: "admin" }, { role: "readWrite", db: "local" }, ] } )
MongoDB 2.4
要备份的MongoDB2.4实例,备份代理需要以下权限:文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
- clusterAdmin
- readAnyDatabase
- userAdminAnyDatabase
同时,还需要以下的角色:文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/
- readWrite 对local库的角色
- readWrite 对admin库的角色
use admin db.addUser( { user: "<username>", pwd: "<password>", roles: [ "clusterAdmin", "readAnyDatabase", "userAdminAnyDatabase" ], otherDBRoles: { local: ['readWrite'], admin: ['readWrite'] } } )文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/文章源自运维生存时间-https://www.ttlsa.com/linux/mms-agent-authentication-requirements/

来自外部的引用