这篇文章主要介绍“ ZooKeeper监控平台的搭建 方法”,在日常操作中,相信很多人在 ZooKeeper监控平台的搭建 方法问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答” ZooKeeper监控平台的搭建 方法”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
系统环境:
SUSE Linux Enterprise Server 10 SP1 (x86_64)
本次采用阿里开源的taokeeper,相关软件包下载地址如下:
taokeeper.sql
http://down.51cto.com/data/718756
taokeeper-monitor-config.properties
http://down.51cto.com/data/715439
taokeeper-monitor
http://down.51cto.com/data/715431
=========================================================================================
一、JAVA环境部署
1、JDK配置
# tar xvzf jdk-7u25-linux-x64.tar.gz -C /usr/local
# cd /usr/local
# ln -s jdk1.7.0_25 jdk
# vim /etc/profile
export JAVA_HOME=/usr/local/jdk
export CLASS_PATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$PATH:$JAVA_HOME/bin
# source /etc/profile
2、Tomcat安装
# tar xvzf apache-tomcat-7.0.39.tar.gz -C /usr/local
# cd /usr/local
# ln -s apache-tomcat-7.0.39 tomcat
=========================================================================================
二、taokeeper部署
# mysql -uroot < taokeeper.sql
# tar xvzf taokeeper-monitor.tar.gz -C /usr/local/tomcat/webapps
# mysql -uroot -e "grant all privileges on taokeeper.* to mytest@'172.18.35.29' identified by '123456';"
# mysql -uroot -e "flush privileges;"
-----------------------------------------------------------------------------------------------------------------------------------------------
# mkdir -p /usr/local/tomcat/webapps/taokeeper-monitor/{config,ZookeeperStore,logs}
# vim /usr/local/tomcat/webapps/taokeeper-monitor/config/taokeeper-monitor-config.properties
systemInfo.envName=TAOKEEPER
#DBCP
dbcp.driverClassName=com.mysql.jdbc.Driver
dbcp.dbJDBCUrl=jdbc:mysql://172.18.35.29:3306/taokeeper
dbcp.characterEncoding=GBK
dbcp.username=mytest
dbcp.password=123456
dbcp.maxActive=30
dbcp.maxIdle=10
dbcp.maxWait=10000
#SystemConstant
SystemConstent.dataStoreBasePath=/usr/local/tomcat/webapps/taokeeper-monitor/ZookeeperStore
SystemConstant.configOfMsgCenter=
#SSH account of zk server
SystemConstant.portOfSSH=22
SystemConstant.userNameOfSSH=root
SystemConstant.passwordOfSSH=123456
#LOGBACK
LOG_HOME=/usr/local/tomcat/webapps/taokeeper-monitor/logs
LOG_LEVEL=DEBUG
MAX_HISTORY_LOG_FILES=10
# chown -R nobody:nogroup /usr/local/tomcat/webapps/taokeeper-monitor
# chmod -R 750 /usr/local/tomcat/webapps/taokeeper-monitor
-----------------------------------------------------------------------------------------------------------------------------------------------
# vim /usr/local/tomcat/bin/catalina.sh
在236行后添加:
JAVA_OPTS=-DconfigFilePath="/usr/local/tomcat/webapps/taokeeper-monitor/config/taokeeper-monitor-config.properties"
# vim /usr/local/tomcat/conf/server.xml
修改为内网IP,在22行:
<Server address="172.18.35.29" port="8005" shutdown="SHUTDOWN">
修改为80端口和绑定内网IP,在70行:
<Connector address="172.18.35.29" port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
修改绑定内网IP,在91行:
<Connector address="172.18.35.29" port="8009" protocol="AJP/1.3" redirectPort="8443" />
-----------------------------------------------------------------------------------------------------------------------------------------------
# vim /usr/local/tomcat/webapps/taokeeper-monitor/WEB-INF/classes/log4j.properties
替换其中的日志路径为:
/usr/local/tomcat/webapps/taokeeper-monitor/logs/taokeeper-monitor.log
服务启动:
# /usr/local/tomcat/bin/startup.sh
服务关闭:
# /usr/local/tomcat/bin/shutdown.sh
# echo "alias nc='netcat'" >> /etc/bash.bashrc
# sh /etc/bash.bashrc
-----------------------------------------------------------------------------------------------------------------------------------------------
访问以下地址:
http://172.18.35.29/taokeeper-monitor
=========================================================================================
三、安全设置
1、删除tomcat默认目录
rm -rf /usr/local/tomcat/webapps/*
2、删除jspx文件解析
/usr/local/tomcat/conf/web.xml (368行)
<url-pattern>*.jspx</url-pattern>
3、禁止显示错误信息
/usr/local/tomcat/conf/web.xml
在</welcome-file-list>这一行后面,增加以下内容:
<error-page>
<error-code>500</error-code>
<location>/500.jsp</location>
</error-page>
4、非root模式启动
才用jsvc方式启动总失败,暂未解决
=========================================================================================
四、效果展示
目前还存在的问题:
连接数、Watch数总为0,无法获取,但节点自检是OK的。
到此,关于“ ZooKeeper监控平台的搭建 方法”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。