系统环境:
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的。