Cerebro
cerebro是使用Scala,Play Framework,AngularJS和Bootstrap构建的开源(MIT许可)elasticsearch Web管理工具。
cerebro项目链接
https://github.com/lmenezes/cerebro/releases
下载cerebro rpm 包
wget https://github.com/lmenezes/cerebro/releases/download/v0.9.2/cerebro-0.9.2-1.noarch.rpm
rpm 安装cerebro
rpm -ivh cerebro-0.9.2-1.noarch.rpm
cerebro配置文件
/usr/share/cerebro/conf/application.conf
cerebro日志文件
/var/log/cerebro
cerebro安装文件路径
rpm -ql cerebro
cerebro 版本
rpm -qa cerebro
cerebro-0.9.2-1.noarch
修改Cerebro配置文件
文件末尾修改如下配置
vim /usr/share/cerebro/conf/application.conf
hosts = [
{
host = "http://192.168.10.235:9200"
name = "elk-cluster"
auth = {
username = "elastic"
password = "TcqinZLhbJDFFgCqXF8r"
}
}
]
启动Cerebro
/usr/bin/cerebro 前端运行
[root@elk-node1]# /usr/bin/cerebro
[info] play.api.Play - Application started (Prod) (no global state)
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
systemctl 后台运行
systemctl start cerebro && systemctl enable cerebro
查看Cerebro服务进程
ps -ef |grep cerebro
访问Cerebro
http://ip:9000
登录页
首页
集群节点页
删除索引数据
更多操作
使用Nginx做Cerebro反向代理
添加 http basic 认证文件
htpasswd -c /etc/nginx/passwd.db admin
/etc/nginx/为认证密码文件的存放路径,passwd.db为认证密码文件,admin为
认证的用户名。
使用htpasswd 需要先安装Apache Httpd密码生成工具
yum install httpd-tools -y
或者
echo "admin:`openssl passwd admin123`" >> /etc/nginx/passwd.db
Nginx 反向代理配置
server {
listen 55601;
server_name 192.168.10.235;
access_log /var/log/nginx/access/cerebro_access.log main ;
error_log /var/log/nginx/error/cerebro_error.log ;
location /{
auth_basic "Protect cerebro";
auth_basic_user_file /etc/nginx/passwd.db;
proxy_pass http://127.0.0.1:9000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 15;
proxy_send_timeout 30;
proxy_read_timeout 30;
proxy_redirect off;
proxy_buffering off;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
启动 Nginx 服务
#检查nginx配置
nginx -t
#启动nginx服务
systemctl start nginx
#开机启动nginx服务
systemctl enable nginx
#重载nginx服务
systemctl reload nginx
cerebro 监听端口和监听地址配置
[root@elk-node1 cerebro]# /usr/bin/cerebro -Dhttp.port=9000 -Dhttp.address=127.0.0.1
[info] play.api.Play - Application started (Prod) (no global state)
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /127.0.0.1:9000
systemctl 后台启动指定监听端口和监听地址
[root@elk-node1 ~]# cat /usr/lib/systemd/system/cerebro.service
[Unit]
Description=Elasticsearch web admin tool
Requires=network.target
[Service]
Type=simple
WorkingDirectory=/usr/share/cerebro
EnvironmentFile=/etc/default/cerebro
ExecStart=/usr/share/cerebro/bin/cerebro -Dhttp.port=9000 -Dhttp.address=127.0.0.1
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=60
SuccessExitStatus=143
TimeoutStopSec=5
User=cerebro
ExecStartPre=/bin/mkdir -p /run/cerebro
ExecStartPre=/bin/chown cerebro:cerebro /run/cerebro
ExecStartPre=/bin/chmod 755 /run/cerebro
PermissionsStartOnly=true
LimitNOFILE=1024
[Install]
WantedBy=multi-user.target
访问Nginx 反向代理地址
http://ip:55601