天天看點

Centos7 搭建Cerebro Elasticsearch監控 

簡介

Cerebro是一款Elasticsearch監控工具

項目Github首頁

Centos7 搭建Cerebro Elasticsearch監控 

overview.png

Centos7 搭建Cerebro Elasticsearch監控 

nodes.png

Centos7 搭建Cerebro Elasticsearch監控 

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
           
elk