当前位置:   article > 正文

zkui安装、部署,用于管理zookeeper集群_zkud

zkud

环境:

centos7、zkui2.0、zookeeper 3.5.8

一、拉取zkui项目

  1.升级安装git

yum  -y install git

  2.拉取项目

   

git clone https://github.com/DeemOpen/zkui.git

 二、配置zkui jar包

  1.maven编译源码

  1. cd zkui/
  2. mvn clean install

  2.使用生成的jar包

     zkui-2.0-SNAPSHOT-jar-with-dependencies.jar

  3.编辑配置文件

  1. cd zkui
  2. vim config.cfg

   

  1. #Server Port
  2. serverPort=9090
  3. #Comma seperated list of all the zookeeper servers
  4. zkServer=localhost:2181,localhost:2181
  5. #Http path of the repository. Ignore if you dont intent to upload files from repository.
  6. scmRepo=xxx.xxx.xx.xx:2181,xxx.xxx.xx.xx:2182,xxx.xxx.xx.xx:2183
  7. #Path appended to the repo url. Ignore if you dont intent to upload files from repository.
  8. scmRepoPath=//appconfig.txt
  9. #if set to true then userSet is used for authentication, else ldap authentication is used.
  10. ldapAuth=false
  11. ldapDomain=mycompany,mydomain
  12. #ldap authentication url. Ignore if using file based authentication.
  13. ldapUrl=ldap://<ldap_host>:<ldap_port>/dc=mycom,dc=com
  14. #Specific roles for ldap authenticated users. Ignore if using file based authentication.
  15. ldapRoleSet={"users": [{ "username":"domain\\user1" , "role": "ADMIN" }]}
  16. userSet = {"users": [{ "username":"admin" , "password":"manager","role": "ADMIN" },{ "username":"appconfig" , "password":"appconfig","role": "USER" }]}
  17. #Set to prod in production and dev in local. Setting to dev will clear history each time.
  18. env=prod
  19. jdbcClass=org.h2.Driver
  20. jdbcUrl=jdbc:h2:zkui
  21. jdbcUser=root
  22. jdbcPwd=manager
  23. #If you want to use mysql db to store history then comment the h2 db section.
  24. #jdbcClass=com.mysql.jdbc.Driver
  25. #jdbcUrl=jdbc:mysql://localhost:3306/zkui
  26. #jdbcUser=root
  27. #jdbcPwd=manager
  28. loginMessage=Please login using admin/manager or appconfig/appconfig.
  29. #session timeout 5 mins/300 secs.
  30. sessionTimeout=300
  31. #Default 5 seconds to keep short lived zk sessions. If you have large data then the read will take more than 30 seconds so increase this accordingly.
  32. #A bigger zkSessionTimeout means the connection will be held longer and resource consumption will be high.
  33. zkSessionTimeout=5
  34. #Block PWD exposure over rest call.
  35. blockPwdOverRest=false
  36. #ignore rest of the props below if https=false.
  37. https=false
  38. keystoreFile=/home/user/keystore.jks
  39. keystorePwd=password
  40. keystoreManagerPwd=password
  41. # The default ACL to use for all creation of nodes. If left blank, then all nodes will be universally accessible
  42. # Permissions are based on single character flags: c (Create), r (read), w (write), d (delete), a (admin), * (all)
  43. # For example defaultAcl={"acls": [{"scheme":"ip", "id":"192.168.1.192", "perms":"*"}, {"scheme":"ip", id":"192.168.1.0/24", "perms":"r"}]
  44. defaultAcl=
  45. # Set X-Forwarded-For to true if zkui is behind a proxy
  46. X-Forwarded-For=false

 

 4.关于配置文件的说明:

   (1) 如果是zk集群,scmRepo=xxx.xxx.xx.xx:2181,xxx.xxx.xx.xx:2182,xxx.xxx.xx.xx:2183需要填写集群各个节点服务器(即  Zookeeper节点)的IP地址加端口号2181,我的zookeeper 集群是在同一台服务器部署伪集群,所以ip一样,端口不一样。
若报KeeperErrorCode = ConnectionLoss for / 错误,增大zkSessionTimeout超时时间,设置zkSessionTimeout=20

   (2)默认用户信息

     用户名:Admin(Admin权限,支持CRUD操作)
     密码:manager
     用户名:appconfig(Readonly权限,支持读取操作)
     密码:appconfig

   (3)LDAP的配置  

     如果使用 LDAP 身份验证,则提供 LDAP url。
     这将优先于 roleSet property 文件认证。
     ldapUrl=ldap://<ldap_host>:<ldap_port>/dc=mycom,dc=com
     如果不提供此功能,则将使用默认 roleSet 文件认证。

三、运行zkui.jar

    1.创建zkui目录,把 zkui-2.0-SNAPSHOT-jar-with-dependencies.jar、config.cfg放在同一个目录zkui中。

  1. cd zkui
  2. nohup java -jar zkui-2.0-SNAPSHOT-jar-with-dependencies.jar >zkui.log &

   

   2.查看是否启动成功

   

netstat  -tunpl |grep  :9090

   

 

四、浏览器访问 http://xxx.xxx.xx.xx:9090/login 账号admin 密码manager

   

 

 

 

 

 五、问题

  1.点击Hosts时:

  

  2.查看日志信息:

  

tail -f zkui-out.log

   

 3.解决办法:

   (1).查看docker 容器

docker ps

      

  (2)进入任意一个zookeeper节点

docker exec -it c2ab27ffbedd bash

 

  1. root@c2ab27ffbedd:/apache-zookeeper-3.5.8-bin# ls
  2. LICENSE.txt NOTICE.txt README.md README_packaging.txt bin conf docs lib
  3. root@c2ab27ffbedd:/apache-zookeeper-3.5.8-bin# cd bin/
  4. root@c2ab27ffbedd:/apache-zookeeper-3.5.8-bin/bin# ls
  5. README.txt zkCleanup.sh zkCli.cmd zkCli.sh zkEnv.cmd zkEnv.sh zkServer-initialize.sh zkServer.cmd zkServer.sh zkTxnLogToolkit.cmd zkTxnLogToolkit.sh

  执行命令:

 

zkCli.sh -server xxx.xx.xx.xx:2183

 

root@c2ab27ffbedd:/apache-zookeeper-3.5.8-bin/bin# zkCli.sh -server xxx.xx.xx.xx:2183
  1. Connecting to xxx.xx.xx.xx:2183
  2. 2020-09-25 08:46:34,268 [myid:] - INFO [main:Environment@109] - Client environment:zookeeper.version=3.5.8-f439ca583e70862c3068a1f2a7d4d068eec33315, built on 05/04/2020 15:07 GMT
  3. 2020-09-25 08:46:34,273 [myid:] - INFO [main:Environment@109] - Client environment:host.name=c2ab27ffbedd
  4. 2020-09-25 08:46:34,273 [myid:] - INFO [main:Environment@109] - Client environment:java.version=11.0.8
  5. 2020-09-25 08:46:34,275 [myid:] - INFO [main:Environment@109] - Client environment:java.vendor=N/A
  6. 2020-09-25 08:46:34,275 [myid:] - INFO [main:Environment@109] - Client environment:java.home=/usr/local/openjdk-11
  7. 2020-09-25 08:46:34,278 [myid:] - INFO [main:Environment@109] - Client environment:java.class.path=/apache-zookeeper-3.5.8-bin/bin/../zookeeper-server/target/classes:/apache-zookeeper-3.5.8-bin/bin/../build/classes:/apache-zookeeper-3.5.8-bin/bin/../zookeeper-server/target/lib/*.jar:/apache-zookeeper-3.5.8-bin/bin/../build/lib/*.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/zookeeper-jute-3.5.8.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/zookeeper-3.5.8.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/slf4j-log4j12-1.7.25.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/slf4j-api-1.7.25.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/netty-transport-native-unix-common-4.1.48.Final.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/netty-transport-native-epoll-4.1.48.Final.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/netty-transport-4.1.48.Final.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/netty-resolver-4.1.48.Final.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/netty-handler-4.1.48.Final.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/netty-common-4.1.48.Final.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/netty-codec-4.1.48.Final.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/netty-buffer-4.1.48.Final.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/log4j-1.2.17.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/json-simple-1.1.1.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/jline-2.11.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/jetty-util-9.4.24.v20191120.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/jetty-servlet-9.4.24.v20191120.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/jetty-server-9.4.24.v20191120.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/jetty-security-9.4.24.v20191120.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/jetty-io-9.4.24.v20191120.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/jetty-http-9.4.24.v20191120.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/javax.servlet-api-3.1.0.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/jackson-databind-2.10.3.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/jackson-core-2.10.3.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/jackson-annotations-2.10.3.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/commons-cli-1.2.jar:/apache-zookeeper-3.5.8-bin/bin/../lib/audience-annotations-0.5.0.jar:/apache-zookeeper-3.5.8-bin/bin/../zookeeper-*.jar:/apache-zookeeper-3.5.8-bin/bin/../zookeeper-server/src/main/resources/lib/*.jar:/conf:
  8. 2020-09-25 08:46:34,278 [myid:] - INFO [main:Environment@109] - Client environment:java.library.path=/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
  9. 2020-09-25 08:46:34,278 [myid:] - INFO [main:Environment@109] - Client environment:java.io.tmpdir=/tmp
  10. 2020-09-25 08:46:34,278 [myid:] - INFO [main:Environment@109] - Client environment:java.compiler=<NA>
  11. 2020-09-25 08:46:34,278 [myid:] - INFO [main:Environment@109] - Client environment:os.name=Linux
  12. 2020-09-25 08:46:34,278 [myid:] - INFO [main:Environment@109] - Client environment:os.arch=amd64
  13. 2020-09-25 08:46:34,279 [myid:] - INFO [main:Environment@109] - Client environment:os.version=3.10.0-862.14.4.el7.x86_64
  14. 2020-09-25 08:46:34,279 [myid:] - INFO [main:Environment@109] - Client environment:user.name=root
  15. 2020-09-25 08:46:34,279 [myid:] - INFO [main:Environment@109] - Client environment:user.home=/root
  16. 2020-09-25 08:46:34,279 [myid:] - INFO [main:Environment@109] - Client environment:user.dir=/apache-zookeeper-3.5.8-bin/bin
  17. 2020-09-25 08:46:34,279 [myid:] - INFO [main:Environment@109] - Client environment:os.memory.free=22MB
  18. 2020-09-25 08:46:34,283 [myid:] - INFO [main:Environment@109] - Client environment:os.memory.max=247MB
  19. 2020-09-25 08:46:34,283 [myid:] - INFO [main:Environment@109] - Client environment:os.memory.total=29MB
  20. 2020-09-25 08:46:34,290 [myid:] - INFO [main:ZooKeeper@868] - Initiating client connection, connectString=120.27.16.15:2183 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@6e2c9341
  21. 2020-09-25 08:46:34,301 [myid:] - INFO [main:X509Util@79] - Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
  22. 2020-09-25 08:46:34,327 [myid:] - INFO [main:ClientCnxnSocket@237] - jute.maxbuffer value is 4194304 Bytes
  23. 2020-09-25 08:46:34,353 [myid:] - INFO [main:ClientCnxn@1653] - zookeeper.request.timeout value is 0. feature enabled=
  24. Welcome to ZooKeeper!
  25. JLine support is enabled
  26. 2020-09-25 08:46:34,566 [myid:120.27.16.15:2183] - INFO [main-SendThread(120.27.16.15:2183):ClientCnxn$SendThread@1112] - Opening socket connection to server 120.27.16.15/120.27.16.15:2183. Will not attempt to authenticate using SASL (unknown error)
  27. 2020-09-25 08:46:34,590 [myid:120.27.16.15:2183] - INFO [main-SendThread(120.27.16.15:2183):ClientCnxn$SendThread@959] - Socket connection established, initiating session, client: /172.19.0.4:43810, server: 120.27.16.15/120.27.16.15:2183
  28. [zk: 120.27.16.15:2183(CONNECTING) 0] 2020-09-25 08:46:34,645 [myid:120.27.16.15:2183] - INFO [main-SendThread(120.27.16.15:2183):ClientCnxn$SendThread@1394] - Session establishment complete on server 120.27.16.15/120.27.16.15:2183, sessionid = 0x303b55a83990000, negotiated timeout = 30000
  29. WATCHER::
  30. WatchedEvent state:SyncConnected type:None path:null

  (3)创建节点/appconfig、  /appconfig/hosts

 

  

  1. [zk: 120.27.16.15:2183(CONNECTED) 0] ls
  2. ls [-s] [-w] [-R] path
  3. [zk: 120.27.16.15:2183(CONNECTED) 1] create /appconfig 'appconfig'
  4. Node already exists: /appconfig
  5. [zk: 120.27.16.15:2183(CONNECTED) 2] create /appconfig 'appconfig'
  6. Created /appconfig
  7. [zk: 120.27.16.15:2183(CONNECTED) 3] create /appconfig/hosts xxx.xx.xx.xx
  8. Created /appconfig/hosts

  (4)刷新页面

   

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/正经夜光杯/article/detail/976182
推荐阅读
相关标签
  

闽ICP备14008679号