MongoDB Ops Manager(MMS)是用于监控和备份MongoDB的基础设施服务。其中监控的服务是免费的,备份的服务是须要收费的。本文以最新的4.0.1为例,介绍如何安装配置MongoDB Ops Manager服务。web
[root@hdp04 ~]# 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的配置文件以下:mongodb
[root@hdp04 ~]# 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服务:shell
[root@hdp04 ~]# systemctl start mongod [root@hdp04 ~]# 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.
[root@hdp04 ~]# yum -y install mongodb-mms.x86_64 [root@hdp04 ~]# vi /opt/mongodb/mms/conf/conf-mms.properties #根据实际状况修改mongodb的地址 mongo.mongoUri=mongodb://127.0.0.1:27017/?maxPoolSize=150 mongo.ssl=false
安装配置完成后,启动服务,默认的端口是8080:app
[root@hdp04 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 ] [root@hdp04 conf]# netstat -antpl|grep 8080 tcp6 0 0 :::8080 :::* LISTEN 10494/mms-app
3.1 打开Ops管理界面
经过服务ops的8080端口,便可打开web管理界面,以下图所示:
3.2 注册管理员帐号
3.3 设置Web Server和Email
设置Web Server和Email,其余的默认便可,以下图所示:
3.4 设置用户认证方式
这里使用默认的application database,以下图:
3.5 备份快照设置
使用默认的设置便可,以下图:curl
依次点击Agents->Download & Settings, 会出现全部的代理信息,如图所示:
根据实际需求选择代理类型,这里使用Automation代理。环境的操做系统是Oracle Linux 7,因此点击Centos 7对应的rpm链接,弹出安装操做步骤:
安装提示,依次在各个节点安装配置,以hdp06为例,以下:tcp
[root@hdp06 ~]# 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 [root@hdp06 ~]# yum -y localinstall mongodb-mms-automation-agent-manager-5.4.9.5483-1.x86_64.rhel7.rpm [root@hdp06 ~]# vi /etc/mongodb-mms/automation-agent.config mmsBaseUrl=http://192.168.120.99:8080 mmsGroupId=5b7b8bf6dd601873cb8ea94d mmsApiKey=5b7b94f0dd601873cb8eb08e7890df416e37a186bcd77e40235210b6
须要说明的是配置文件中的mmsGroupId和mmsApiKey两个选项。mmsGroupId使用弹出的代理安装手册的值,而mmsApiKey须要点击代理安装手册中的√Key Generated方可生成。编辑完配置文件后启动代理服务:ide
[root@hdp06 ~]# systemctl start mongodb-mms-automation-agent.service [root@hdp06 ~]# systemctl status mongodb-mms-automation-agent.service
待全部的代理安装配置完成后,会在web管理界面看到,以下图所示:url
点击下图红色箭头所指的连接:
在下图中输入任意一节点的主机名以及端口号,点击continue,以下图:
按照图中提示,一步一步往下操做便可导入。最终的结果以下所示:操作系统