Centos7 搭建Cerebro Elasticsearch监控

简介

Cerebro是一款Elasticsearch监控工具
项目Github主页

Centos7 搭建Cerebro Elasticsearch监控_第1张图片
overview.png

Centos7 搭建Cerebro Elasticsearch监控_第2张图片
nodes.png
Centos7 搭建Cerebro Elasticsearch监控_第3张图片
rest.png

创建用户

useradd -s /sbin/nologin cerebro

解压安装文件

mkdir /opt/cerebro;\
tar xf /tmp/cerebro-0.8.1.tgz -C /opt/cerebro;\
ln -s /opt/cerebro/cerebro-0.8.1 /opt/cerebro/current;\
chown -R cerebro. /opt/cerebro

更改配置

  • auth.settings
    访问Cerebro的用户名及密码
  • hosts
    要监控的Elasticsearch集群,host:节点访问地址,name:标识,一般用ES的cluster_name
mkdir /home/cerebro/data;\
chown -R cerebro. /home/cerebro;\
tee /opt/cerebro/current/conf/application.conf << 'EOF'
secret="ki:s:[[@=Ag?QI`W2jMwkY:eqvrJ]JqoJyi2axj3ZvOv^/KavOT4ViJSv?6YY4[N"
basePath="/"
pidfile.path="/opt/cerebro/current/cerebro.pid"
data.path="/home/cerebro/data/cerebro.db"
es={
    gzip=true
}
auth={
    type: basic
    settings: {
        username="admin"
        password="Admin_2018"
    }
}
hosts=[
  {
    host="http://192.168.1.141:9200"
    name="es_log"
  }
]
EOF

创建服务

tee /etc/systemd/system/cerebro.service << 'EOF'
[Unit]
Description=Cerebro
After=network.target

[Service]
Type=folking
PIDFile=/opt/cerebro/current/cerebro.pid
User=cerebro
Group=cerebro
LimitNOFILE=65535
ExecStart=/opt/cerebro/current/bin/cerebro -Dconfig.file=/opt/cerebro/current/conf/application.conf
Restart=on-failure
WorkingDirectory=/opt/cerebro/current

[Install]
WantedBy=multi-user.target
EOF

启动

systemctl daemon-reload;\
systemctl enable cerebro;\
systemctl start cerebro;\
systemctl status cerebro

开启防火墙

firewall-cmd --add-port=9000/tcp --permanent ;\
firewall-cmd --reload

访问

默认端口为9000,若需要修改端口

  • port
    暴露的端口
  • address
    默认为0.0.0.0,设置为0.0.0.0表示对该主机所有网卡开放
tee -a /etc/systemd/system/cerebro.service << 'EOF'
http = {
    port = "9000"
    address = "192.168.1.144"
}
EOF

你可能感兴趣的:(Centos7 搭建Cerebro Elasticsearch监控)