Elasticasearch Web管理工具 - Cerebro


cerebro是一个使用Scala,Play Framework,AngularJS和Bootstrap构建的开源(MIT许可)elasticsearch web管理工具。需要Java 1.8或更高版本才能运行。

1、安装JAVA环境

tar -xzvf jdk-8u121-linux-x64.tar.gz -C /data

配置环境

/etc/profile文件中添加

export JAVA_HOME=/data/jdk1.8.0_121
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

重载文件

source /etc/profile

2、安装Cerebro

下载插件

https://github.com/lmenezes/cerebro/releases/download/v0.8.3/cerebro-0.8.3.zip
unzip cerebro-0.8.3.zip

 配置文件application.conf

hosts = [
  {
    host = "http://10.10.18.10:9200"    #es集群中任意一台
    name = "es_cluster_name"
  },
]

配置supervisor管理cerebro

安装supervisor

pip install supervisor
echo_supervisord_conf > /data/supervisor/supervisord.conf

修改文件: /data/supervisor/supervisord.conf

[include]
files = /data/supervisor/conf.d/*.ini

创建cerebro的ini文件 /data/supervisor/conf.d/cerebro.ini

[program:cerebro]
command=/data/cerebro/cerebro-0.8.3/bin/cerebro  -Dhttp.port=1234 -Dhttp.address=127.0.0.1
directory=/data/cerebro/cerebro-0.8.3/
autostart=true
autorestart=true
numprocs=1 
priority=1 
;startsecs=1 
startretries=3
stopasgroup=true
killasgroup=true
stdout_logfile=/data/cerebro/cerebro-0.8.3/logs/supervisord_cerebro_out.log
stderr_logfile=/data/cerebro/cerebro-0.8.3/logs/supervisord_cerebro_err.log

启动supervisord服务

/usr/bin/supervisord -c /data/supervisor/supervisord.conf

安装完成

3、使用nginx做Cerebro反向代理

准备http basic认证文件

echo "admin:`openssl passwd 111111`" >> /etc/nginx/passwd.db 

nginx的配置文件

server {
        listen      35601;
        server_name  10.10.18.10;
        access_log      /data/www/logs/nginx_log/access/cerebro_access.log main ;
        error_log      /data/www/logs/nginx_log/error/cerebro_error.log ;
        location /{
            auth_basic "Protect cerebro";
            auth_basic_user_file /etc/nginx/passwd.db;
            proxy_pass http://127.0.0.1:1234;
            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服务器

使用浏览器就可以访问Cerebro服务

linuxboy的RSS地址:https://www.linuxboy.net/rssFeed.aspx

本文永久更新链接地址:https://www.linuxboy.net/Linux/2019-07/159252.htm

相关内容

    暂无相关文章