【es】es界面化管理工具cerebro的安装和使用

一、 Cerebro简介


Cerebro 是 Elasticsearch 版本5.x 以前插件 Elasticsearch Kopf 的演变,可以通过图形界面查看分片分配和执行常见的索引操作。

Cerebro是一个使用Scala,Play Framework,AngularJS和Bootstrap构建的开源(MIT许可)elasticsearch web管理工具,比Kibana轻量很多,很适用与生产和测试等环境的es集群管理。

它是kopf的升级版本,更改了个名字,包含kopf的功能(监控工具,并包含head插件的部分功能,可图形化的进行新建索引等操作。

现在kopf已经不再更新,只对cerebro进行维护。

Cerebro的运行需要Java 1.8或更高版本才能运行。


二、安装 Cerebro


默认es集群和java环境已经配置完成。


安装方式一:使用官方安装包安装


https://github.com/lmenezes/cerebro/releases

如果你想做 docker 安装,请参阅链接 https://github.com/lmenezes/cerebro-docker



# wget  https://github.com/lmenezes/cerebro/releases/download/v0.9.4/cerebro-0.9.4.zip

# unzip cerebro-0.9.4.zip  -d  /opt


# useradd  cerebro

# chown -R  cerebro:cerebro    /opt/cerebro-0.9.4/


# vim   /etc/systemd//system/cerebro.service  

#######################################################################

[Unit]

Description=Cerebro

Requires=network.target

[Service]

Type=simple

WorkingDirectory=/opt/cerebro-0.9.4

ExecStart= /opt/cerebro-0.9.4/bin/cerebro  -Dhttp.address=0.0.00  -Dhttp.port=9000

ExecReload=/bin/kill -HUP $MAINPID

Restart=always

RestartSec=60

SuccessExitStatus=143

TimeoutStopSec=5

User=cerebro

ExecStartPre=/bin/mkdir -p /run/cerebro  /var/lib/cerebro

ExecStartPre=/bin/chown cerebro:cerebro /run/cerebro  /var/lib/cerebro

ExecStartPre=/bin/chmod 755 /run/cerebro  /var/lib/cerebro

PermissionsStartOnly=true

LimitNOFILE=1024

[Install]

WantedBy=multi-user.target

########################################################################


#  vim    /opt/cerebro-0.9.4/conf/application.conf

###################################

data.path: "/var/lib/cerebro/cerebro.db"

###################################

# vim   /opt/cerebro-0.9.4/bin/cerebro 

#####################################

JAVA_HOME="/opt/jre-1.8.0_112"

#####################################


# systemctl daemon-reload 

# systemctl enable cerebro 

# systemctl restart  cerebro 

# systemctl status  cerebro 



安装方式二:CentOS7.x上使用rpm安装


# wget  https://github.com/lmenezes/cerebro/releases/download/v0.9.4/cerebro-0.9.4-1.noarch.rpm

# yum -y localinstall  cerebro-0.9.4-1.noarch.rpm

或者

# yum -y install https://github.com/lmenezes/cerebro/releases/download/v0.9.4/cerebro-0.9.4-1.noarch.rpm


#  vim /usr/share/cerebro/bin/cerebro

############################################

JAVA_HOME="/opt/jre-1.8.0_112"

#############################################


# vim /usr/share/cerebro/conf/application.conf

###################################

data.path: "/var/lib/cerebro/cerebro.db"

###################################

# systemctl daemon-reload 

# systemctl enable cerebro

# systemctl restart  cerebro 

# systemctl status  cerebro


三、访问和使用


浏览器登陆 http://xx.xx.xx.xx:9000,看到开始页面即为成功。

Node address  输入es集群master节点的一个地址  http://xx.xx.xx.xx:9200


1.overview界面

集群节点、索引、分片、文档数量、磁盘使用量等信息

2.nodes界面

各个节点的具体信息,包括负载、cpu、堆、磁盘使用、启动时间等信息


3.more功能

包含了很多常用功能,创建索引、查看集群设置,别名、分析等功能



4. 如果索引的分片分布不均匀,可以选中某个节点上的分片,重新分配

5.  Rest页,提供了对Elasticsearch的基本操作,发送DSL请求对数据进行操作o(GET/POST/PUT/DELETE)


cerebro能满足我们对es集群的日常管理维护 ,还是直接上图比较直观。

支持索引创建删除,修改集群配置参数 等等,其他功能有需要的可以多研究研究。

 需要注意的是 delete index 命令在生产环境切勿乱执行,要慎重!




四、给 cerebro前端加一个nginx做认证


更新cerebro启动参数配置,让其只监听 127.0.0.1:9000

# vim  /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.address=127.0.0.1 -Dhttp.port=9000

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

################################################################



# systemctl  deamon-reload

# systemctl restart  cerebro 

# systemctl status cerebro 


# yum -y install epel-release  nginx 

# cat /etc/nginx/nginx.conf

############################################################

user nginx;

worker_processes auto;

error_log /var/log/nginx/error.log;

pid /run/nginx.pid;

events {

    worker_connections  1024;

}

http {

server {

        listen        9001;

        server_name  192.168.100.153;

        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;

        }

  }

}

############################################################


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

# cat  /etc/nginx/passwd.db

######################

admin:VkEypoHtWIksI

######################


#  systemctl restart  nginx  

#  systemctl  status nginx  



http://xx.xx.xx.xx:9001 --------> http://127.0.0.1:9000


http://192.168.100.153:9001


五、参考


Elasticsearch工具cerebro的安装与使用

https://www.cnblogs.com/muhu/p/14485913.html


What Is SQLite?

https://www.sqlite.org/index.html


ES 集群管理工具--cerebro

https://mp.weixin.qq.com/s/AU1pW9icOLl5F_vPQt2-Aw


Elasticasearch Web管理工具-Cerebro

https://www.cnblogs.com/sz-wenbin/p/11104238.html

https://www.bianchengquan.com/article/400242.html


ELK插件Cerebro(kopf升级版)安装

https://blog.csdn.net/Netceor/article/details/114584092


ES集群监控 之 Cerebro 0.8.3 安装及简单使用

https://www.cnblogs.com/remainsu/p/es-ji-qun-jian-kong-zhi-cerebro-083-an-zhuang-ji-j.html

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容