MongoDB Ops Manager(MMS)是用于监控和备份MongoDB的基础设施服务。其中监控的服务是免费的,备份的服务是需要收费的。本文以最新的4.0.1为例,介绍如何安装配置MongoDB Ops Manager服务。
1、安装并配置MongoDB服务
[[email protected] ~]# yum -y install mongodb-org.x86_64 mongodb-org-mongos.x86_64 mongodb-org-shell.x86_64 mongodb-org-tools.x86_64 mongodb-org-server.x86_64
创建MongoDB的配置文件如下:
[[email protected] ~]# vi /etc/mongod.conf
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
net:
port: 27017
bindIp: 0.0.0.0
启动MongoDB服务:
[[email protected] ~]# systemctl start mongod
[[email protected] ~]# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2018-08-21 11:43:23 CST; 2h 38min ago
Docs: https://docs.mongodb.org/manual
Main PID: 29211 (mongod)
CGroup: /system.slice/mongod.service
└─29211 /usr/bin/mongod -f /etc/mongod.conf
Aug 21 11:43:21 hdp04 systemd[1]: Starting MongoDB Database Server...
Aug 21 11:43:22 hdp04 mongod[29208]: 2018-08-21T11:43:22.052+0800 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols ‘none‘
Aug 21 11:43:22 hdp04 mongod[29208]: about to fork child process, waiting until server is ready for connections.
Aug 21 11:43:22 hdp04 mongod[29208]: forked process: 29211
Aug 21 11:43:23 hdp04 mongod[29208]: child process started successfully, parent exiting
Aug 21 11:43:23 hdp04 systemd[1]: Started MongoDB Database Server.
2、安装MongoDB Ops Manager
[[email protected] ~]# yum -y install mongodb-mms.x86_64
[[email protected] ~]# vi /opt/mongodb/mms/conf/conf-mms.properties
#根据实际情况修改mongodb的地址
mongo.mongoUri=mongodb://127.0.0.1:27017/?maxPoolSize=150
mongo.ssl=false
安装配置完成后,启动服务,默认的端口是8080:
[[email protected] conf]# /etc/init.d/mongodb-mms start
Generating new Ops Manager private key...
Starting pre-flight checks
Successfully finished pre-flight checks
Migrate Ops Manager data
Running migrations...[ OK ]
Start Ops Manager server
Instance 0 starting......................[ OK ]
Starting pre-flight checks
Successfully finished pre-flight checks
Start Backup Daemon...[ OK ]
[[email protected] conf]# netstat -antpl|grep 8080
tcp6 0 0 :::8080 :::* LISTEN 10494/mms-app
3、配置MongoDB Ops Manager
3.1 打开Ops管理界面
通过服务ops的8080端口,即可打开web管理界面,如下图所示:
3.2 注册管理员账号
3.3 设置Web Server和Email
设置Web Server和Email,其他的默认即可,如下图所示:
3.4 设置用户认证方式
这里使用默认的application database,如下图:
3.5 备份快照设置
使用默认的设置即可,如下图:
4、配置MongoDB Ops Manager Agent
依次点击Agents->Download & Settings, 会出现所有的代理信息,如图所示:
根据实际需求选择代理类型,这里使用Automation代理。环境的操作系统是Oracle Linux 7,所以点击Centos 7对应的rpm连接,弹出安装操作步骤:
安装提示,依次在各个节点安装配置,以hdp06为例,如下:
[[email protected] ~]# curl -OL http://192.168.120.99:8080/download/agent/automation/mongodb-mms-automation-agent-manager-5.4.9.5483-1.x86_64.rhel7.rpm
[[email protected] ~]# yum -y localinstall mongodb-mms-automation-agent-manager-5.4.9.5483-1.x86_64.rhel7.rpm
[[email protected] ~]# vi /etc/mongodb-mms/automation-agent.config
mmsBaseUrl=http://192.168.120.99:8080
mmsGroupId=5b7b8bf6dd601873cb8ea94d
mmsApiKey=5b7b94f0dd601873cb8eb08e7890df416e37a186bcd77e40235210b6
需要说明的是配置文件中的mmsGroupId和mmsApiKey两个选项。mmsGroupId使用弹出的代理安装手册的值,而mmsApiKey需要点击代理安装手册中的√Key Generated方可生成。编辑完配置文件后启动代理服务:
[[email protected] ~]# systemctl start mongodb-mms-automation-agent.service
[[email protected] ~]# systemctl status mongodb-mms-automation-agent.service
待所有的代理安装配置完成后,会在web管理界面看到,如下图所示:
5、监控现有的Sharding Cluster服务
点击下图红色箭头所指的链接:
在下图中输入任意一节点的主机名以及端口号,点击continue,如下图:
按照图中提示,一步一步往下操作即可导入。最终的结果如下所示:
原文地址:http://blog.51cto.com/candon123/2162461