0%

Ops Manager安装部署

安装Ops Manager

下载Ops Manager

DownLoad

安装MongoDB数据库

安装Ops之前需要准备一个MongoDB用于存放数据,安装可参考:MongoDB环境部署

安装Ops manager

1
rpm -ivh mongodb-mms-4.0.5.50245.20181031T0042Z-1.x86_64.rpm

配置Ops Manager

1
2
3
4
[root@t-luhx02-v-szzb mongodb]# vi /opt/mongodb/mms/conf/conf-mms.properties
mms.centralUrl=http://10.0.139.162:8080
mongo.mongoUri=mongodb://10.0.139.162:30000
automation.versions.source=local

如果数据库为副本集且开启了认证登录URI需要设置如下:

1
2
mongo.replicaSet=repl01
mongo.mongoUri=mongodb://USER:PASSWORD@10.240.204.157:27017,10.240.204.165:27017,10.240.204.149:27017

用户需要有readWriteAnyDatabase、clusterAdmin和dbAdminAnyDatabase权限

启动Ops Manager

1
2
3
4
5
6
7
8
9
10
[root@t-luhx02-v-szzb mongodb]# service mongodb-mms start
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

配置Ops Manager

Ops Manager启动之后就可以通过浏览器访问http://10.0.139.162:8080

注册用户

img1

设置WEB服务

img2

设置邮件

img3

后续非必填的可以先忽略进行下一步

版本设置

进入主页后,需要对Ops Manager上的MongoDB版本进行管理,

img4

拉到最下方,选择update version

img5

由于内网机器没有连接网络,更新会失败,我们可以根据提示在本地联网电脑上访问复制到窗口中

img6

将需要托管的MongoDB数据库版本安装包(TGZ)放到/opt/mongodb/mms/mongodb-releases/下,再回到version Manager页面,选中对应版本并点击左上角REVIEW & DEPLOY按钮确认

img7

Automation Agent安装

对需要加入到Ops Manager中的MongoDB节点都需要安装Automation Agent,并需要加入/etc/hosts解析。

点击Agents查看对应的版本的Agent安装说明

img8

Automation Agent Installation Instructions
To save time, you can repeat each step of these instructions in parallel across servers with the same OS

  1. Download the agent

    1
    curl -OL http://10.0.139.162:8080/download/agent/automation/mongodb-mms-automation-agent-manager-5.4.13.5505-1.x86_64.rhel7.rpm

    and install the package.

    1
    sudo rpm -U mongodb-mms-automation-agent-manager-5.4.13.5505-1.x86_64.rhel7.rpm
  2. Create a new Agent API Key. After being generated, keys will only be shown once.
    Treat this API Key like a password.

  3. Next, open the config file

    1
    sudo vi /etc/mongodb-mms/automation-agent.config

    and enter your API key, Project ID, and Ops Manager Base URL as shown below.

    1
    2
    3
    mmsGroupId=5e86eedd4e57d5944be91d06
    mmsApiKey=<Insert Agent API Key Here>
    mmsBaseUrl=http://10.0.139.162:8080

    To manage your API keys, visit the Agent API Keys tab.

  4. Prepare the /data directory to store your MongoDB data. This directory must be owned by the mongod user.

    1
    2
    sudo mkdir -p /data
    sudo chown mongod:mongod /data
  5. Start the agent.

    1
    sudo systemctl start mongodb-mms-automation-agent.service

    On SUSE, it may be necessary to run:

    1
    sudo /sbin/service mongodb-mms-automation-agent start

Monitoring agent安装

根据官方建议,每一套监控环境之中只需要安装一个monitoring agent/backup agent即可;因此,我们选择ops manager的监控节点作为monitor agent的安装节点

img9

点击左上角REVIEW & DEPLOY进行确认安装

img7-2

img10

监控MongoDB

创建监控用户

1
2
3
4
5
6
7
> use admin
> db.createUser(
{
user: "ops",
pwd: "ops",
roles: [ { role: "clusterAdmin", db: "admin" },{ role: "dbAdminAnyDatabase", db: "admin" },{ role: "readWriteAnyDatabase", db: "admin" },{ role: "userAdminAnyDatabase", db: "admin" }]
})

添加已存在的项目

img11

填写节点相关信息,群集环境只需要填写一个节点的信息,会自动获取关联节点,分片环境可直接填入Mongos的信息

img12

等遍历完所有节点信息,即可点击Continue

img13

取消自动安装AUTOMATION

img14

查看监控信息

img15

点击对应节点能获取节点详细信息

img16

备份mongodb

Ops Manager额外提供了MongoDB的热备份功能,备份对象是针对副本集或分片环境,单实例无法进行备份。

ops backup

安装Backup Agent

bak01

点击配置BACKUP模块

backup01

配置Head database目录,用以存放backup daemon实例

backup02

选择备份类型

backup03

Ops Manager额外提供了MongoDB的热备份功能,支持三种备份方式:

  • File System:文件系统存储,每次备份都会生成一个目录单独存放备份快照,不支持增量备份
  • Database Storage:以MongoDB数据库作为备份存储,支持增量备份
  • AWS S3 Bucket:磁带库存储,备份快照以块格式存储在磁带库中,支持增量备份

回到首页,点击begin setup

backup04

校验backup agent

backup05

选择要备份的对象

backup06

第一次会自动进行备份

backup07

检查快照

backup08

检查日志

backup09

查看快照保留策略

backup10

分片环境需要开启checkpoint才能进行恢复