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

环境:

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编译源码

cd zkui/

mvn clean install

  2.使用生成的jar包

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

  3.编辑配置文件

cd zkui

vim config.cfg

   

#Server Port
serverPort=9090
#Comma seperated list of all the zookeeper servers
zkServer=localhost:2181,localhost:2181
#Http path of the repository. Ignore if you dont intent to upload files from repository.
scmRepo=xxx.xxx.xx.xx:2181,xxx.xxx.xx.xx:2182,xxx.xxx.xx.xx:2183
#Path appended to the repo url. Ignore if you dont intent to upload files from repository.
scmRepoPath=//appconfig.txt
#if set to true then userSet is used for authentication, else ldap authentication is used.
ldapAuth=false
ldapDomain=mycompany,mydomain
#ldap authentication url. Ignore if using file based authentication.
ldapUrl=ldap://<ldap_host>:<ldap_port>/dc=mycom,dc=com
#Specific roles for ldap authenticated users. Ignore if using file based authentication.
ldapRoleSet={"users": [{ "username":"domain\\user1" , "role": "ADMIN" }]}
userSet = {"users": [{ "username":"admin" , "password":"manager","role": "ADMIN" },{ "username":"appconfig" , "password":"appconfig","role": "USER" }]}
#Set to prod in production and dev in local. Setting to dev will clear history each time.
env=prod
jdbcClass=org.h2.Driver
jdbcUrl=jdbc:h2:zkui
jdbcUser=root
jdbcPwd=manager
#If you want to use mysql db to store history then comment the h2 db section.
#jdbcClass=com.mysql.jdbc.Driver
#jdbcUrl=jdbc:mysql://localhost:3306/zkui
#jdbcUser=root
#jdbcPwd=manager
loginMessage=Please login using admin/manager or appconfig/appconfig.
#session timeout 5 mins/300 secs.
sessionTimeout=300
#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. 
#A bigger zkSessionTimeout means the connection will be held longer and resource consumption will be high.
zkSessionTimeout=5
#Block PWD exposure over rest call.
blockPwdOverRest=false
#ignore rest of the props below if https=false.
https=false
keystoreFile=/home/user/keystore.jks
keystorePwd=password
keystoreManagerPwd=password
# The default ACL to use for all creation of nodes. If left blank, then all nodes will be universally accessible
# Permissions are based on single character flags: c (Create), r (read), w (write), d (delete), a (admin), * (all)
# For example defaultAcl={"acls": [{"scheme":"ip", "id":"192.168.1.192", "perms":"*"}, {"scheme":"ip", id":"192.168.1.0/24", "perms":"r"}]
defaultAcl=
# Set X-Forwarded-For to true if zkui is behind a proxy
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中。

cd zkui

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

 

root@c2ab27ffbedd:/apache-zookeeper-3.5.8-bin# ls
LICENSE.txt  NOTICE.txt  README.md  README_packaging.txt  bin  conf  docs  lib
root@c2ab27ffbedd:/apache-zookeeper-3.5.8-bin# cd bin/
root@c2ab27ffbedd:/apache-zookeeper-3.5.8-bin/bin# ls
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
Connecting to xxx.xx.xx.xx:2183
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
2020-09-25 08:46:34,273 [myid:] - INFO  [main:Environment@109] - Client environment:host.name=c2ab27ffbedd
2020-09-25 08:46:34,273 [myid:] - INFO  [main:Environment@109] - Client environment:java.version=11.0.8
2020-09-25 08:46:34,275 [myid:] - INFO  [main:Environment@109] - Client environment:java.vendor=N/A
2020-09-25 08:46:34,275 [myid:] - INFO  [main:Environment@109] - Client environment:java.home=/usr/local/openjdk-11
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:
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
2020-09-25 08:46:34,278 [myid:] - INFO  [main:Environment@109] - Client environment:java.io.tmpdir=/tmp
2020-09-25 08:46:34,278 [myid:] - INFO  [main:Environment@109] - Client environment:java.compiler=<NA>
2020-09-25 08:46:34,278 [myid:] - INFO  [main:Environment@109] - Client environment:os.name=Linux
2020-09-25 08:46:34,278 [myid:] - INFO  [main:Environment@109] - Client environment:os.arch=amd64
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
2020-09-25 08:46:34,279 [myid:] - INFO  [main:Environment@109] - Client environment:user.name=root
2020-09-25 08:46:34,279 [myid:] - INFO  [main:Environment@109] - Client environment:user.home=/root
2020-09-25 08:46:34,279 [myid:] - INFO  [main:Environment@109] - Client environment:user.dir=/apache-zookeeper-3.5.8-bin/bin
2020-09-25 08:46:34,279 [myid:] - INFO  [main:Environment@109] - Client environment:os.memory.free=22MB
2020-09-25 08:46:34,283 [myid:] - INFO  [main:Environment@109] - Client environment:os.memory.max=247MB
2020-09-25 08:46:34,283 [myid:] - INFO  [main:Environment@109] - Client environment:os.memory.total=29MB
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
2020-09-25 08:46:34,301 [myid:] - INFO  [main:X509Util@79] - Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
2020-09-25 08:46:34,327 [myid:] - INFO  [main:ClientCnxnSocket@237] - jute.maxbuffer value is 4194304 Bytes
2020-09-25 08:46:34,353 [myid:] - INFO  [main:ClientCnxn@1653] - zookeeper.request.timeout value is 0. feature enabled=
Welcome to ZooKeeper!
JLine support is enabled
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)
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
[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

WATCHER::

WatchedEvent state:SyncConnected type:None path:null

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

 

  

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

  (4)刷新页面

   

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Hi,all

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值