Exhibitor(zookeeper监控工具)

具体看github上的文档,很详细https://github.com/soabase/exhibitor/wiki/Running-Exhibitor

一、

这个是Netflix出品的一个监控工具,但实际上也很难用。。

Exhibitor的主要功能 监控本机的Zookeeper服务,可以自动重启挂掉的Zookeeper服务;
 定期备份数据;
 定期清理Zookeeper日志;
 提供了一个Web界面可以修改Zookeeper的数据;
 REST API。

Exhibitor安装

Exhibitor提供了三种运行方式:独立的jar文件,War包,core jar。推荐用jar方式运行,配置管理都很方便。 
安装方法可以参考这里:https://github.com/Netflix/exhibitor/wiki/Building-Exhibitor,也可以从这里下载已经编绎好的jar文件:文件:Exhibitor-war-1.0-jar-with-dependencies.zip,下载后要修改后缀为jar。 

运行

 java -jar <path>/exhibitor-xxx.jar -c file
Exhibitor自动创建配置文件,在web界面所做的配置更改都会保存到exhibitor.properties中。 

配置项

参考:https://github.com/Netflix/exhibitor/wiki/Configuration-UI 
在配置“Servers”参数时,一定要注意要配置的是hostname,而不是IP。所以如果配置的是IP的话,一定要到目标机器上去检查hostname和IP是否一致。 

注意事项 

Exhibitor通过jps命令来判断Zookeeper服务是否运行,所以要配置好jps命令,如果没有当前没有jps命令的话,可以通过类似如下的命令创建一个软链接:
 ln -s /home/www/jdk/jdk1.7.0_15/bin/jps /usr/bin/jps

 Exhibitor会自动创建并覆盖zookeeper的配置文件,所以要在Web界面上把Zookeeper的所有参数都配置,
 否则如果Zookeeper被Exhibitor重启后,可以会出现因为配置有错误而无法启动的状况。

 在“control panel”面板中,当显示绿色,则说明Zookeeper服务正常,可以对外服务,当显示黄色或者红色,
 则Zookeeper不能对外提供服务(这个和Zookeeper进程是否存在,是两个概念,即使Zookeeper进程存在,也可能无法对外提供服务)。

 Exhibitor会定时探测Zookeeper服务是否正常,但是时间间隔默认配置为0,这个会导致机器CPU被消耗。要在Web界面中配置好“Live Check (ms)”参数。

 因为Exhibitor如果探测到Zookeeper服务没有启动,会自动启动Zookeeper进程,所以在升级Zookeeper之前,要先停掉Exhibitor。

二、

1. github下载源代码
    https://github.com/Netflix/exhibitor,下载zip包。
 
2. 编译
    进入目录:exhibitor-masterexhibitor-masterexhibitor-standalonesrcmain esourcesuildscriptsstandalonemaven>
    执行命令:mvn clean package 【我编译好的:http://pan.baidu.com/s/1slF2gVz 】
    把编译好的target下的jar上传到服务器,执行:java -jar exhibitor-1.5.6.jar -c file
 
3. 使用
    可以重启集群中的Zookeeper、查看节点信息、配置集群中的Zookeeper、查看log等操作
    
    例子:
    制作一份集群中都共享的配置(需要在集群中的服务器都安装exhibitor的jar)
    
原文地址:https://www.cnblogs.com/zhangmingcheng/p/7117523.html