Centos7 搭建Cerebro Elasticsearch監控

weixin_33850890發表於2018-09-07

簡介

Cerebro是一款Elasticsearch監控工具
專案Github主頁

12211662-1c2c759f72c73339.png
overview.png

12211662-f11cdbe2c41078ab.png
nodes.png
12211662-5e0fa59f0915af2c.png
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

相關文章