您好,登錄后才能下訂單哦!
這篇文章主要介紹“ 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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。