ES 集群管理工具 cerebro

栏目: 后端 · 发布时间: 6年前

内容简介:因为公司技术方面的需求,前一段时间折腾了一下elasticsearch,总体技术水平能够达到简历上的有管理ES集群经验的朋友肯定都知道elasticsearch的head插件能够实现对es集群的查看,索引分片,展示数据分布等功能,但是在页面美观上有点欠缺。本文介绍一款es集群管理平台--cerebro。cerebro算是一款"绿色"软件,只要有标准的java环境,下载解压之后即可使用。

前言

因为公司技术方面的需求,前一段时间折腾了一下elasticsearch,总体技术水平能够达到简历上的 “熟悉” 的程度。

有管理ES集群经验的朋友肯定都知道elasticsearch的head插件能够实现对es集群的查看,索引分片,展示数据分布等功能,但是在页面美观上有点欠缺。本文介绍一款es集群管理平台--cerebro。

cerebro简介

cerebro算是一款"绿色"软件,只要有标准的 java 环境,下载解压之后即可使用。

在功能上cerebro支持节点状态监控 服务器磁盘空间,cpu,load,索引数量大小 ,数据分布位置等监控。 支持查询。

安装

wget "https://github.com/lmenezes/cerebro/releases/download/v0.8.1/cerebro-0.8.1.tgz"
tar -zxf cerebro-0.8.1.tgz

解压之后其实只有四个文件夹,我们只需要关注bin 和conf目录,bin有可执行文件 cerebo ,conf里面有需要访问es集群的配置文件。

[root# /opt/cerebro]
# ls
bin  cerebro.db  conf  lib  logs  README.md

编辑配置文件

vim conf/application.conf

hosts = [
  {
    host = "http://localhost:9200"
    name = "es-test"
  }
  # Example of host with authentication
  #{
  #  host = "http://some-authenticated-host:9200"
  #  name = "Secured Cluster"
  #  auth = {
  #    username = "username"
  #    password = "secret-password"
  #  }
  #}
]

这里我们选择不带用户权限校验的方式。

启动

cd /opt/cerebro 
nohup ./bin/cerebro -Dhttp.port=8800 -Dhttp.address=0.0.0.0 &

界面展示

ES 集群管理工具 cerebro

功能

能满足我们对es集群的日常管理维护 ,还是直接上图比较直观。支持索引创建删除,修改集群配置参数 等等,其他功能有需要的可以多研究研究。 需要注意的是 delete index 命令在生产环境切勿乱执行,要慎重。

ES 集群管理工具 cerebro

ES 集群管理工具 cerebro

运维

因为现在公司已经在正式环境中使用cerebro,为了标准化程序管理,我写了一个小脚本支持启动关闭查看状态。该 工具 默认 cerebro 是安装在/opt/cerebro 目录 。当然也推荐把cerebro的程序交给supervisor管理。

#!/bin/sh
#
# chkconfig: 2345 86 14
# description: cerebro agent daemon
# processname: cerebro
#
# nohup ./bin/cerebro -Dhttp.port=9000 -Dhttp.address=0.0.0.0 >> /tmp/cerebro.log &
# Source function library.
. /etc/rc.d/init.d/functions

if [ -x /opt/cerebro ]; then
    exec=/opt/cerebro/bin/cerebro
else
    exit 5
fi

prog=${exec##*/}
cerebro="/opt/cerebro/bin/cerebro"
conf_file="/opt/cerebro/conf/application.conf"
pidfile="/var/run/cerebro.pid"
timeout=2
lockfile=/var/lock/subsys/$prog
logdir="/data/logs/cerebro.log"

## "cd /opt/yz-falcon-agent/; $exec -c $conf >>$logdir/stdout.log 2>>$logdir/stderr.log &"
start()
{
    echo "Starting cerebro: "
    daemon --user root --pidfile $pidfile " $cerebro -Dhttp.port=9000 -Dhttp.address=0.0.0.0 >>/data/logs/cerebro.log 2>/dev/null &"
    RETVAL=$?
    [ $RETVAL -eq 0 ] && touch $lockfile
    [ $RETVAL -eq 0 -a ! -f $pidfile ] && pidof java  > $pidfile
    pid=`cat $pidfile`
    echo "start $prog, pid is $pid"
    return $RETVAL
}

stop()
{
    echo -n $"Shutting down cerebro: "
    killproc -p $pidfile -d $timeout $prog
    rv=$?
    echo
    [ $rv -eq 0 ] && rm -f $lockfile
    return $rv
}

restart()
{
    stop
    start
}

case "$1" in
    start|stop|restart)
        $1
        ;;
    status)
        status -p $pidfile $prog
        ;;
    *)
    echo $"Usage: $0 {start|stop|status|restart}"
    exit 2
    ;;
esac

启动

ES 集群管理工具 cerebro 查看状态

关闭

推荐阅读

https://mp.weixin.qq.com/s/BE8LrpviJNXGV41bhzGFTw

supervisor 工具介绍


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Natural Language Processing with Python

Natural Language Processing with Python

Steven Bird、Ewan Klein、Edward Loper / O'Reilly Media / 2009-7-10 / USD 44.99

This book offers a highly accessible introduction to Natural Language Processing, the field that underpins a variety of language technologies, ranging from predictive text and email filtering to autom......一起来看看 《Natural Language Processing with Python》 这本书的介绍吧!

html转js在线工具
html转js在线工具

html转js在线工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具