分佈式協調服務Zookeeper集羣監控JMX和ZkWeb應用對比html
做者:尹正傑java
版權聲明:原創做品,謝絕轉載!不然將追究法律責任。node
JMX是用來遠程監控Java應用的框架,這個也能夠用來監控其餘的Java應用。JMX使用起來也很簡單。固然還有一款比較優秀的監控工具就是ZkWeb,本片博客都會簡單介紹部署方式。git
JMX官方地址:http://zookeeper.apache.org/doc/r3.4.14/zookeeperJMX.html。github
ZkWeb的github地址:https://github.com/zhitom/zkwebweb
分佈式協調服務Zookeeper集羣搭建:http://www.javashuo.com/article/p-ohaiqdid-nc.html。spring
一.zookeeper服務開啓JMX監控(不推薦使用該方式)apache
1>.修改zookeeper的啓動腳本 json
.......... #ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=$JMXLOCALONLY org.apache.zookeeper.server.quorum.QuorumPeerMain" #將ZOOMAIN的默認配置註釋掉! ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false #是否創建遠程鏈接,false可遠程創建鏈接 -Djava.rmi.server.hostname=127.0.0.1 #zookeeper地址 -Dcom.sun.management.jmxremote.port=8888 #JMX鏈接端口,並非zookeeper端口,也不能和zookeeper端口衝突 -Dcom.sun.management.jmxremote.ssl=true # 是否ssl鏈接,若是JMX沒法ssl鏈接上zookeeper,須要改成false -Dcom.sun.management.jmxremote.authenticate=true # 是否開啓訪問權限,若是設置爲true的話,須要指定access和password存放路徑,就在下面兩行(若是不配置安全認真刪除當前行和下面2行便可!) -Dcom.sun.management.jmxremote.access.file=/yinzhengjie/softwares/zookeeper-3.4.14/conf/jmxremote.access # 設置訪問權限,須要指定對應的路徑,下面哪一個文件是指定具體的用戶名和密碼 -Dcom.sun.management.jmxremote.password.file=/yinzhengjie/softwares/zookeeper-3.4.14/conf/jmxremote.password -Dzookeeper.jmx.log4j.disable=true # 是否開日誌 org.apache.zookeeper.server.quorum.QuorumPeerMain" ..........
2>.在「Dcom.sun.management.jmxremote.access.file」和「Dcom.sun.management.jmxremote.password.file」對應的目錄下建立相應的文件,結合上面我們寫的文件名稱api
[root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/zookeeper-3.4.14/conf/jmxremote.access monitorRole readonly controlRole readwrite create javax.management.monitor.*,javax.management.timer.* unregister [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/zookeeper-3.4.14/conf/jmxremote.password monitorRole 123 controlRole 456 [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/zookeeper-3.4.14/conf/ | grep jmxremote -rw-r--r--. 1 root root 148 Apr 25 17:09 jmxremote.access -rw-r--r--. 1 root root 34 Apr 25 17:09 jmxremote.password [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# chmod 600 /yinzhengjie/softwares/zookeeper-3.4.14/conf/jmxremote.* [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/zookeeper-3.4.14/conf/ | grep jmxremote -rw-------. 1 root root 148 Apr 25 17:09 jmxremote.access -rw-------. 1 root root 34 Apr 25 17:09 jmxremote.password [root@node101.yinzhengjie.org.cn ~]#
須要注意的是,若是上面修改的2個文件的權限配置爲600,會拋出異常,以下圖所示:
[root@node102.yinzhengjie.org.cn ~]# cat zookeeper.out Error: Password file read access must be restricted: /yinzhengjie/softwares/zookeeper-3.4.14/conf/jmxremote.password sun.management.AgentConfigurationError at sun.management.jmxremote.ConnectorBootstrap.checkPasswordFile(ConnectorBootstrap.java:577) at sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:426) at sun.management.Agent.startAgent(Agent.java:262) at sun.management.Agent.startAgent(Agent.java:452) [root@node102.yinzhengjie.org.cn ~]#
3>.同步配置文件到其餘節點中並重啓zookeeper集羣
[root@node101.yinzhengjie.org.cn ~]# scp -rp /yinzhengjie/softwares/zookeeper-3.4.14/ node102.yinzhengjie.org.cn:/yinzhengjie/softwares/ ...... WatchedEvent.java 100% 2729 7.2MB/s 00:00 VerGen.java 100% 7307 16.8MB/s 00:00 ClientCnxn.java 100% 60KB 65.7MB/s 00:00 AtomicFileOutputStream.java 100% 4608 10.7MB/s 00:00 Time.java 100% 1966 3.9MB/s 00:00 IOUtils.java 100% 3898 9.4MB/s 00:00 PathUtils.java 100% 3740 8.6MB/s 00:00 PathTrie.java 100% 8546 17.1MB/s 00:00 Watcher.java 100% 5895 14.8MB/s 00:00 SaslClientCallbackHandler.java 100% 5447 12.8MB/s 00:00 StatsTrack.java 100% 2773 6.1MB/s 00:00 SaslServerPrincipal.java 100% 4601 9.9MB/s 00:00 ServerAdminClient.java 100% 11KB 19.7MB/s 00:00 AsyncCallback.java 100% 12KB 19.1MB/s 00:00 ManagedUtil.java 100% 2612 5.5MB/s 00:00 ZKMBeanInfo.java 100% 1332 2.1MB/s 00:00 CommonNames.java 100% 1144 2.8MB/s 00:00 MBeanRegistry.java 100% 7326 12.5MB/s 00:00 OpResult.java 100% 5269 2.4MB/s 00:00 ZooKeeper.java 100% 73KB 42.8MB/s 00:00 Environment.java 100% 3443 6.3MB/s 00:00 Op.java 100% 11KB 17.4MB/s 00:00 ZooKeeperTestable.java 100% 1731 4.2MB/s 00:00 ClientCnxnSocketNIO.java 100% 15KB 30.4MB/s 00:00 StaticHostProvider.java 100% 6505 15.3MB/s 00:00 FourLetterWordMain.java 100% 3949 5.9MB/s 00:00 HostProvider.java 100% 2347 5.5MB/s 00:00 ZooKeeperSaslClient.java 100% 20KB 33.7MB/s 00:00 ConnectStringParser.java 100% 2932 7.5MB/s 00:00 Testable.java 100% 1074 2.8MB/s 00:00 MultiTransactionRecord.java 100% 5423 12.7MB/s 00:00 ZooKeeperMain.java 100% 32KB 50.4MB/s 00:00 ClientWatchManager.java 100% 1548 3.8MB/s 00:00 MultiResponse.java 100% 5955 12.9MB/s 00:00 pom.template 100% 1950 5.5MB/s 00:00 NOTICE.txt 100% 3132 8.3MB/s 00:00 lastRevision.bat 100% 1006 2.5MB/s 00:00 LICENSE.txt 100% 12KB 23.6MB/s 00:00 overview.html 100% 1017 3.1MB/s 00:00 lastRevision.sh 100% 910 2.7MB/s 00:00 log4j-1.2.17.LICENSE.txt 100% 11KB 22.4MB/s 00:00 jline-0.9.94.LICENSE.txt 100% 1489 4.5MB/s 00:00 slf4j-1.7.25.LICENSE.txt 100% 1135 3.5MB/s 00:00 README.txt 100% 215 637.1KB/s 00:00 zookeeper_3.1.1.xml 100% 113KB 77.3MB/s 00:00 zookeeper_3.4.14.xml 100% 204KB 86.5MB/s 00:00 zookeeper-env.sh 100% 841 2.3MB/s 00:00 update-zookeeper-env.sh 100% 3817 10.8MB/s 00:00 zookeeper 100% 3760 10.3MB/s 00:00 prerm 100% 1011 1.8MB/s 00:00 conffile 100% 796 1.5MB/s 00:00 control 100% 1153 1.0MB/s 00:00 preinst 100% 1005 3.0MB/s 00:00 postrm 100% 852 2.2MB/s 00:00 postinst 100% 979 2.9MB/s 00:00 zookeeper 100% 1801 5.0MB/s 00:00 zookeeper.spec 100% 6489 10.6MB/s 00:00 log4j-1.2.17.LICENSE.txt 100% 11KB 23.4MB/s 00:00 jline-0.9.94.LICENSE.txt 100% 1489 3.5MB/s 00:00 netty-3.10.6.Final.jar 100% 1262KB 107.0MB/s 00:00 slf4j-api-1.7.25.jar 100% 40KB 44.1MB/s 00:00 slf4j-1.7.25.LICENSE.txt 100% 1135 3.0MB/s 00:00 audience-annotations-0.5.0.jar 100% 20KB 37.2MB/s 00:00 log4j-1.2.17.jar 100% 478KB 100.3MB/s 00:00 slf4j-log4j12-1.7.25.jar 100% 12KB 20.6MB/s 00:00 README.txt 100% 215 497.9KB/s 00:00 zookeeper_3.1.1.xml 100% 113KB 62.6MB/s 00:00 zookeeper_3.4.14.xml 100% 204KB 93.7MB/s 00:00 jline-0.9.94.jar 100% 85KB 72.5MB/s 00:00 [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# scp -rp /yinzhengjie/softwares/zookeeper-3.4.14/ node103.yinzhengjie.org.cn:/yinzhengjie/softwares/ ...... StatsTrack.java 100% 2773 6.8MB/s 00:00 SaslServerPrincipal.java 100% 4601 8.7MB/s 00:00 ServerAdminClient.java 100% 11KB 25.2MB/s 00:00 AsyncCallback.java 100% 12KB 21.2MB/s 00:00 ManagedUtil.java 100% 2612 4.9MB/s 00:00 ZKMBeanInfo.java 100% 1332 2.1MB/s 00:00 CommonNames.java 100% 1144 1.1MB/s 00:00 MBeanRegistry.java 100% 7326 16.4MB/s 00:00 OpResult.java 100% 5269 9.8MB/s 00:00 ZooKeeper.java 100% 73KB 64.7MB/s 00:00 Environment.java 100% 3443 9.1MB/s 00:00 Op.java 100% 11KB 25.1MB/s 00:00 ZooKeeperTestable.java 100% 1731 4.7MB/s 00:00 ClientCnxnSocketNIO.java 100% 15KB 28.8MB/s 00:00 StaticHostProvider.java 100% 6505 15.8MB/s 00:00 FourLetterWordMain.java 100% 3949 11.7MB/s 00:00 HostProvider.java 100% 2347 7.2MB/s 00:00 ZooKeeperSaslClient.java 100% 20KB 25.3MB/s 00:00 ConnectStringParser.java 100% 2932 7.3MB/s 00:00 Testable.java 100% 1074 3.5MB/s 00:00 MultiTransactionRecord.java 100% 5423 13.5MB/s 00:00 ZooKeeperMain.java 100% 32KB 43.8MB/s 00:00 ClientWatchManager.java 100% 1548 4.9MB/s 00:00 MultiResponse.java 100% 5955 15.7MB/s 00:00 pom.template 100% 1950 6.3MB/s 00:00 NOTICE.txt 100% 3132 8.1MB/s 00:00 lastRevision.bat 100% 1006 2.4MB/s 00:00 LICENSE.txt 100% 12KB 16.3MB/s 00:00 overview.html 100% 1017 2.6MB/s 00:00 lastRevision.sh 100% 910 2.8MB/s 00:00 log4j-1.2.17.LICENSE.txt 100% 11KB 23.7MB/s 00:00 jline-0.9.94.LICENSE.txt 100% 1489 5.0MB/s 00:00 slf4j-1.7.25.LICENSE.txt 100% 1135 3.1MB/s 00:00 README.txt 100% 215 603.6KB/s 00:00 zookeeper_3.1.1.xml 100% 113KB 69.5MB/s 00:00 zookeeper_3.4.14.xml 100% 204KB 93.3MB/s 00:00 zookeeper-env.sh 100% 841 905.3KB/s 00:00 update-zookeeper-env.sh 100% 3817 6.6MB/s 00:00 zookeeper 100% 3760 10.1MB/s 00:00 prerm 100% 1011 3.5MB/s 00:00 conffile 100% 796 2.3MB/s 00:00 control 100% 1153 3.7MB/s 00:00 preinst 100% 1005 2.8MB/s 00:00 postrm 100% 852 2.2MB/s 00:00 postinst 100% 979 3.1MB/s 00:00 zookeeper 100% 1801 4.9MB/s 00:00 zookeeper.spec 100% 6489 15.8MB/s 00:00 log4j-1.2.17.LICENSE.txt 100% 11KB 25.9MB/s 00:00 jline-0.9.94.LICENSE.txt 100% 1489 5.3MB/s 00:00 netty-3.10.6.Final.jar 100% 1262KB 104.0MB/s 00:00 slf4j-api-1.7.25.jar 100% 40KB 27.0MB/s 00:00 slf4j-1.7.25.LICENSE.txt 100% 1135 2.5MB/s 00:00 audience-annotations-0.5.0.jar 100% 20KB 35.0MB/s 00:00 log4j-1.2.17.jar 100% 478KB 102.9MB/s 00:00 slf4j-log4j12-1.7.25.jar 100% 12KB 21.6MB/s 00:00 README.txt 100% 215 731.0KB/s 00:00 zookeeper_3.1.1.xml 100% 113KB 82.8MB/s 00:00 zookeeper_3.4.14.xml 100% 204KB 97.9MB/s 00:00 jline-0.9.94.jar 100% 85KB 76.1MB/s 00:00 [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cat /usr/local/bin/xzk.sh #!/bin/bash #@author :yinzhengjie #blog:http://www.cnblogs.com/yinzhengjie #EMAIL:y1053419035@qq.com #判斷用戶是否傳參 if [ $# -ne 1 ];then echo "無效參數,用法爲: $0 {start|stop|restart|status}" exit fi #獲取用戶輸入的命令 cmd=$1 #定義函數功能 function zookeeperManger(){ case $cmd in start) echo "啓動服務" remoteExecution start ;; stop) echo "中止服務" remoteExecution stop ;; restart) echo "重啓服務" remoteExecution restart ;; status) echo "查看狀態" remoteExecution status ;; *) echo "無效參數,用法爲: $0 {start|stop|restart|status}" ;; esac } #定義執行的命令 function remoteExecution(){ for (( i=101 ; i<=103 ; i++ )) ; do tput setaf 2 echo ========== node${i}.yinzhengjie.org.cn zkServer.sh $1 ================ tput setaf 9 ssh node${i}.yinzhengjie.org.cn "source /etc/profile ; zkServer.sh $1" done } #調用函數 zookeeperManger [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# xzk.sh restart 重啓服務 ========== node101.yinzhengjie.org.cn zkServer.sh restart ================ ZooKeeper JMX enabled by default Using config: /yinzhengjie/softwares/zookeeper-3.4.14/bin/../conf/zoo.cfg ZooKeeper JMX enabled by default Using config: /yinzhengjie/softwares/zookeeper-3.4.14/bin/../conf/zoo.cfg Stopping zookeeper ... no zookeeper to stop (could not find file /home/yinzhengjie/zookeeper/zookeeper_server.pid) ZooKeeper JMX enabled by default Using config: /yinzhengjie/softwares/zookeeper-3.4.14/bin/../conf/zoo.cfg Starting zookeeper ... STARTED ========== node102.yinzhengjie.org.cn zkServer.sh restart ================ ZooKeeper JMX enabled by default Using config: /yinzhengjie/softwares/zookeeper-3.4.14/bin/../conf/zoo.cfg ZooKeeper JMX enabled by default Using config: /yinzhengjie/softwares/zookeeper-3.4.14/bin/../conf/zoo.cfg Stopping zookeeper ... no zookeeper to stop (could not find file /home/yinzhengjie/zookeeper/zookeeper_server.pid) ZooKeeper JMX enabled by default Using config: /yinzhengjie/softwares/zookeeper-3.4.14/bin/../conf/zoo.cfg Starting zookeeper ... STARTED ========== node103.yinzhengjie.org.cn zkServer.sh restart ================ ZooKeeper JMX enabled by default Using config: /yinzhengjie/softwares/zookeeper-3.4.14/bin/../conf/zoo.cfg ZooKeeper JMX enabled by default Using config: /yinzhengjie/softwares/zookeeper-3.4.14/bin/../conf/zoo.cfg Stopping zookeeper ... no zookeeper to stop (could not find file /home/yinzhengjie/zookeeper/zookeeper_server.pid) ZooKeeper JMX enabled by default Using config: /yinzhengjie/softwares/zookeeper-3.4.14/bin/../conf/zoo.cfg Starting zookeeper ... STARTED [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# xzk.sh status 查看狀態 ========== node101.yinzhengjie.org.cn zkServer.sh status ================ ZooKeeper JMX enabled by default Using config: /yinzhengjie/softwares/zookeeper-3.4.14/bin/../conf/zoo.cfg Mode: follower ========== node102.yinzhengjie.org.cn zkServer.sh status ================ ZooKeeper JMX enabled by default Using config: /yinzhengjie/softwares/zookeeper-3.4.14/bin/../conf/zoo.cfg Mode: leader ========== node103.yinzhengjie.org.cn zkServer.sh status ================ ZooKeeper JMX enabled by default Using config: /yinzhengjie/softwares/zookeeper-3.4.14/bin/../conf/zoo.cfg Mode: follower [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 50 172.30.1.101:3888 *:* LISTEN 0 128 *:6000 *:* LISTEN 0 5 192.168.122.1:53 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 127.0.0.1:631 *:* LISTEN 0 50 *:8888 *:* #咱們能夠看到JMX端口被啓用啦! LISTEN 0 50 *:46079 *:* LISTEN 0 50 *:42687 *:* LISTEN 0 50 *:2181 *:* LISTEN 0 128 :::6000 :::* LISTEN 0 128 :::22 :::* [root@node101.yinzhengjie.org.cn ~]#
參考連接1:http://www.javashuo.com/article/p-fmouppdx-mp.html
參考連接2:https://blog.csdn.net/zk_chs/article/details/84776095#
按照網上的說法咱們就可使用JConsole等工具能夠訪問該咱們配置的JMX端口,惋惜我測試了一個下午都沒有搞定!不知道是否是我機器有問題,你們是否遇到跟我同樣的問題呢?(還好這種監控我沒有弄出來,因而我找到了另外的一款監控工具,基於Web的)
二.zookeeper的web監控工具之ZkWeb(官方地址:https://github.com/zhitom/zkweb)
1>.下載「ZkWeb For Zookeeper」的jar包
下載地址:https://github.com/zhitom/zkweb/releases。
2>.運行ZkWeb的jar包(默認啓動端口是8099)
[root@node101.yinzhengjie.org.cn ~]# ll total 27876 -rw-r--r--. 1 root root 28541920 Apr 26 16:38 zkWeb-v1.2.1.jar [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# java -jar zkWeb-v1.2.1.jar 16:44:19.229 [main] INFO com.yasenagat.zkweb.ZkWebSpringBootApplication - applicationYamlFileName(application-zkweb.yaml)=file:/root/zkWeb-v1.2.1.jar!/BOOT-INF/classes!/application-zkweb.yaml . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.0.2.RELEASE) [2019-04-26 16:44:20 INFO main StartupInfoLogger.java:50] c.y.zkweb.ZkWebSpringBootApplication --> Starting ZkWebSpringBootApplication vv1.2.1 on node101.yinzhengjie.org.cn with PID 12627 (/root/zkWeb-v1.2.1.jar started by root in /root) [2019-04-26 16:44:20 INFO main SpringApplication.java:663] c.y.zkweb.ZkWebSpringBootApplication --> The following profiles are active: local [2019-04-26 16:44:20 INFO main AbstractApplicationContext.java:590] o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext --> Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@39ba5a14: startup date [Fri Apr 26 16:44:20 CST 2019]; root of context hierarchy [2019-04-26 16:44:22 INFO main DefaultListableBeanFactory.java:824] o.s.b.f.s.DefaultListableBeanFactory --> Overriding bean definition for bean 'requestMappingHandlerAdapter' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=zkSpringBootConfiguration; factoryMethodName=requestMappingHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/yasenagat/zkweb/util/ZkSpringBootConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration; factoryMethodName=requestMappingHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]] [2019-04-26 16:44:23 INFO main TomcatWebServer.java:91] o.s.b.w.e.tomcat.TomcatWebServer --> Tomcat initialized with port(s): 8099 (http) [2019-04-26 16:44:23 INFO main DirectJDKLog.java:180] o.a.coyote.http11.Http11NioProtocol --> Initializing ProtocolHandler ["http-nio-8099"] [2019-04-26 16:44:23 INFO main DirectJDKLog.java:180] o.a.catalina.core.StandardService --> Starting service [Tomcat] [2019-04-26 16:44:23 INFO main DirectJDKLog.java:180] o.a.catalina.core.StandardEngine --> Starting Servlet Engine: Apache Tomcat/8.5.31 [2019-04-26 16:44:23 INFO localhost-startStop-1 DirectJDKLog.java:180] o.a.c.core.AprLifecycleListener --> The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib] [2019-04-26 16:44:23 INFO localhost-startStop-1 DirectJDKLog.java:180] o.a.c.c.C.[Tomcat].[localhost].[/] --> Initializing Spring embedded WebApplicationContext [2019-04-26 16:44:23 INFO localhost-startStop-1 ServletWebServerApplicationContext.java:285] o.s.web.context.ContextLoader --> Root WebApplicationContext: initialization completed in 3050 ms [2019-04-26 16:44:23 INFO localhost-startStop-1 ServletRegistrationBean.java:185] o.s.b.w.s.ServletRegistrationBean --> Servlet dispatcherServlet mapped to [/] [2019-04-26 16:44:23 INFO localhost-startStop-1 ServletRegistrationBean.java:185] o.s.b.w.s.ServletRegistrationBean --> Servlet webServlet mapped to [/console/*] [2019-04-26 16:44:23 INFO localhost-startStop-1 ServletRegistrationBean.java:185] o.s.b.w.s.ServletRegistrationBean --> Servlet cacheServlet mapped to [/cache/*] [2019-04-26 16:44:23 INFO localhost-startStop-1 AbstractFilterRegistrationBean.java:244] o.s.b.w.s.FilterRegistrationBean --> Mapping filter: 'characterEncodingFilter' to: [/*] [2019-04-26 16:44:23 INFO localhost-startStop-1 AbstractFilterRegistrationBean.java:244] o.s.b.w.s.FilterRegistrationBean --> Mapping filter: 'hiddenHttpMethodFilter' to: [/*] [2019-04-26 16:44:23 INFO localhost-startStop-1 AbstractFilterRegistrationBean.java:244] o.s.b.w.s.FilterRegistrationBean --> Mapping filter: 'httpPutFormContentFilter' to: [/*] [2019-04-26 16:44:23 INFO localhost-startStop-1 AbstractFilterRegistrationBean.java:244] o.s.b.w.s.FilterRegistrationBean --> Mapping filter: 'requestContextFilter' to: [/*] [2019-04-26 16:44:23 INFO MLog-Init-Reporter Slf4jMLog.java:212] com.mchange.v2.log.MLog --> MLog clients using slf4j logging. [2019-04-26 16:44:23 INFO main Slf4jMLog.java:212] com.mchange.v2.c3p0.C3P0Registry --> Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10] [2019-04-26 16:44:24 INFO main Slf4jMLog.java:212] c.m.v.c.i.AbstractPoolBackedDataSource --> Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 1br8b51a2on62pc1idrz68|5bd03f44, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> org.h2.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1br8b51a2on62pc1idrz68|5bd03f44, idleConnectionTestPeriod -> 60, initialPoolSize -> 10, jdbcUrl -> jdbc:h2:file:~/.h2/zkweb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=TRUE;FILE_LOCK=SOCKET, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 60, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20, maxStatements -> 100, maxStatementsPerConnection -> 0, minPoolSize -> 5, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ] [2019-04-26 16:44:24 ERROR main ZkCfgManagerImpl.java:406] c.y.zkweb.util.ZkCfgManagerImpl --> isTableOk Failed,A problem occurred while trying to acquire a cached PreparedStatement in a background thread. [2019-04-26 16:44:24 ERROR main ZkCfgManagerImpl.java:70] c.y.zkweb.util.ZkCfgManagerImpl --> create table (CREATE TABLE IF NOT EXISTS ZK(ID VARCHAR PRIMARY KEY, DESC VARCHAR, CONNECTSTR VARCHAR, SESSIONTIMEOUT VARCHAR))... [2019-04-26 16:44:24 ERROR main ZkCfgManagerImpl.java:76] c.y.zkweb.util.ZkCfgManagerImpl --> create table OK !ret=0 [2019-04-26 16:44:24 ERROR main ZkCfgManagerImpl.java:81] c.y.zkweb.util.ZkCfgManagerImpl --> table select check OK! [2019-04-26 16:44:24 INFO main ZkCache.java:41] com.yasenagat.zkweb.util.ZkCache --> zk info size=0 [2019-04-26 16:44:24 INFO main ZkCfgManagerImpl.java:436] c.y.zkweb.util.ZkCfgManagerImpl --> afterPropertiesSet init 0 zk instance [2019-04-26 16:44:24 INFO main RequestMappingHandlerAdapter.java:574] o.s.w.s.m.m.a.RequestMappingHandlerAdapter --> Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@39ba5a14: startup date [Fri Apr 26 16:44:20 CST 2019]; root of context hierarchy [2019-04-26 16:44:25 INFO main AbstractUrlHandlerMapping.java:373] o.s.w.s.h.SimpleUrlHandlerMapping --> Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/zkcfg/queryZkCfgById]}" onto public java.util.Map<java.lang.String, java.lang.Object> com.yasenagat.zkweb.web.ZkCfgController.queryZkCfg(java.lang.String) [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/zkcfg/queryZkCfg]}" onto public java.util.Map<java.lang.String, java.lang.Object> com.yasenagat.zkweb.web.ZkCfgController.queryZkCfg(int,int,java.lang.String) [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/zkcfg/addZkCfg],produces=[text/html;charset=UTF-8]}" onto public java.lang.String com.yasenagat.zkweb.web.ZkCfgController.addZkCfg(java.lang.String,java.lang.String,java.lang.String) [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/zkcfg/updateZkCfg],produces=[text/html;charset=UTF-8]}" onto public java.lang.String com.yasenagat.zkweb.web.ZkCfgController.updateZkCfg(java.lang.String,java.lang.String,java.lang.String,java.lang.String) [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/zkcfg/delZkCfg],produces=[text/html;charset=UTF-8]}" onto public java.lang.String com.yasenagat.zkweb.web.ZkCfgController.delZkCfg(java.lang.String) [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/zk/queryZnodeInfo],produces=[text/html;charset=UTF-8]}" onto public java.lang.String com.yasenagat.zkweb.web.ZkController.queryzNodeInfo(java.lang.String,org.springframework.ui.Model,java.lang.String) [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/zk/queryZKOk]}" onto public java.lang.String com.yasenagat.zkweb.web.ZkController.queryZKOk(org.springframework.ui.Model,java.lang.String) [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/zk/queryZKJMXInfo],produces=[application/json;charset=UTF-8]}" onto public java.util.List<com.yasenagat.zkweb.util.ZkManager$PropertyPanel> com.yasenagat.zkweb.web.ZkController.queryZKJMXInfo(java.lang.String,java.lang.String,javax.servlet.http.HttpServletResponse) [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/zk/saveData],produces=[text/html;charset=UTF-8]}" onto public java.lang.String com.yasenagat.zkweb.web.ZkController.saveData(java.lang.String,java.lang.String,java.lang.String) [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/zk/createNode],produces=[text/html;charset=UTF-8]}" onto public java.lang.String com.yasenagat.zkweb.web.ZkController.createNode(java.lang.String,java.lang.String,java.lang.String) [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/zk/deleteNode],produces=[text/html;charset=UTF-8]}" onto public java.lang.String com.yasenagat.zkweb.web.ZkController.deleteNode(java.lang.String,java.lang.String) [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/zk/queryZnode]}" onto public java.util.List<com.yasenagat.zkweb.model.Tree> com.yasenagat.zkweb.web.ZkController.query(java.lang.String,java.lang.String,java.lang.String) [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) [2019-04-26 16:44:25 INFO main AbstractHandlerMethodMapping.java:547] o.s.w.s.m.m.a.RequestMappingHandlerMapping --> Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) [2019-04-26 16:44:25 INFO main AbstractUrlHandlerMapping.java:360] o.s.w.s.h.SimpleUrlHandlerMapping --> Root mapping to handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController] [2019-04-26 16:44:25 INFO main AbstractUrlHandlerMapping.java:373] o.s.w.s.h.SimpleUrlHandlerMapping --> Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] [2019-04-26 16:44:25 INFO main AbstractUrlHandlerMapping.java:373] o.s.w.s.h.SimpleUrlHandlerMapping --> Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] [2019-04-26 16:44:25 INFO main AbstractUrlHandlerMapping.java:373] o.s.w.s.h.SimpleUrlHandlerMapping --> Mapped URL path [/resources/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] [2019-04-26 16:44:25 INFO main MBeanExporter.java:433] o.s.j.e.a.AnnotationMBeanExporter --> Registering beans for JMX exposure on startup [2019-04-26 16:44:25 INFO main DirectJDKLog.java:180] o.a.coyote.http11.Http11NioProtocol --> Starting ProtocolHandler ["http-nio-8099"] [2019-04-26 16:44:25 INFO main DirectJDKLog.java:180] o.a.tomcat.util.net.NioSelectorPool --> Using a shared selector for servlet write/read [2019-04-26 16:44:25 INFO main DirectJDKLog.java:180] o.a.c.c.C.[Tomcat].[localhost].[/] --> Initializing Spring FrameworkServlet 'dispatcherServlet' [2019-04-26 16:44:25 INFO main FrameworkServlet.java:494] o.s.web.servlet.DispatcherServlet --> FrameworkServlet 'dispatcherServlet': initialization started [2019-04-26 16:44:25 INFO main FrameworkServlet.java:509] o.s.web.servlet.DispatcherServlet --> FrameworkServlet 'dispatcherServlet': initialization completed in 16 ms [2019-04-26 16:44:25 INFO main TomcatWebServer.java:206] o.s.b.w.e.tomcat.TomcatWebServer --> Tomcat started on port(s): 8099 (http) with context path '' [2019-04-26 16:44:25 INFO main StartupInfoLogger.java:59] c.y.zkweb.ZkWebSpringBootApplication --> Started ZkWebSpringBootApplication in 6.499 seconds (JVM running for 7.016) [2019-04-26 16:48:35 INFO http-nio-8099-exec-8 ZkCfgController.java:36] c.y.zkweb.web.ZkCfgController --> Fri Apr 26 16:48:35 CST 2019 [2019-04-26 16:48:35 INFO http-nio-8099-exec-8 ZkCfgManagerImpl.java:285] c.y.zkweb.util.ZkCfgManagerImpl --> whereSq=desc like '%%'
3>.成功添加一個節點
4>.查看添加節點的信息
5>.咱們可使用他提供的web界面操做zookeeper集羣喲!