victor-0807 / blog

个人博客
0 stars 1 forks source link

Centos7 搭建Cerebro Elasticsearch监控 #1

Open victor-0807 opened 6 years ago

victor-0807 commented 6 years ago

简介

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

overview.png nodes.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

更改配置

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,若需要修改端口