zookeeper可视化界面zkui搭建与配置
  yyka2UPIbcp2 2023年11月02日 53 0

1准备环境

zookeeper可视化WEB工具 zkui 依赖java环境,因此需要安装JDK,zkui 源码需要maven编译,需要安装Apache-maven。

1、JDK 1.8 :或者安装openJDK ,命令如下:

yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel

2、maven 3.0.5 :Apache-maven下载地址   https://maven.apache.org/download.cgi

3、centos 7,xshell,xftp

(1)设置环境变量

执行命令 vim /etc/profile 在文件末尾添加如下:

# set for nginxPATH=$PATH:/usr/local/nginx/sbinexport PAT#zookeeper-3.4.14 config startexport ZOOKEEPER_HOME=/usr/local/services/zookeeper-3.4.14export PATH=$ZOOKEEPER_HOME/bin:$PATHCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$ZOOKEEPER_HOME/lib:export ZOOKEEPER_HOMEexport JAVA_HOMEexport PATHexport CLASSPATHexport PATH#zookeeepr-3.4.14 config end

查看版本号:

[root@localhost services]# java -versionopenjdk version "1.8.0_262"OpenJDK Runtime Environment (build 1.8.0_262-b10)OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)[root@localhost services]# mvn -vApache Maven 3.0.5 (Red Hat 3.0.5-17)Maven home: /usr/share/mavenJava version: 1.8.0_262, vendor: Oracle CorporationJava home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/jreDefault locale: zh_CN, platform encoding: UTF-8OS name: "linux", version: "3.10.0-1127.el7.x86_64", arch: "amd64", family: "unix"[root@localhost services]#

2搭建zkui

2.1、下载zkui

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

[root@localhost zkui]# ll总用量 100-rw-r--r--. 1 root root 2364 8月 12 10:53 config.cfgdrwxr-xr-x. 2 root root 61 8月 12 10:28 dockerdrwxr-xr-x. 2 root root 114 8月 12 10:28 images-rw-r--r--. 1 root root 11358 8月 12 10:28 LICENSE-2.0.txt-rw-r--r--. 1 root root 416 8月 12 10:28 Makefile-rw-r--r--. 1 root root 1746 8月 12 10:28 nbactions.xml-rw-------. 1 root root 2103 8月 15 08:00 nohup.out-rw-r--r--. 1 root root 5294 8月 12 10:28 pom.xml-rw-r--r--. 1 root root 6216 8月 12 10:28 README.md-rw-r--r--. 1 root root 43 8月 12 10:28 run.shdrwxr-xr-x. 4 root root 30 8月 12 10:28 srcdrwxr-xr-x. 9 root root 264 8月 12 11:10 target-rw-r--r--. 1 root root 43008 8月 15 08:00 zkui.h2.db-rw-r--r--. 1 root root 5008 8月 15 08:01 zkui-out.log[root@localhost zkui]#

2.2、编译zkui,生成jar包

[root@localhost services]# cd zkui/[root@localhost zkui]# mvn clean install.................................编译过程省略..........................................[INFO] --- maven-install-plugin:2.4:install (default-install) @ zkui ---[INFO] Installing /App/zkui/target/zkui-2.0-SNAPSHOT.jar to /root/.m2/repository/com/deem/zkui/2.0-SNAPSHOT/zkui-2.0-SNAPSHOT.jar[INFO] Installing /App/zkui/pom.xml to /root/.m2/repository/com/deem/zkui/2.0-SNAPSHOT/zkui-2.0-SNAPSHOT.pom[INFO] Installing /App/zkui/target/zkui-2.0-SNAPSHOT-jar-with-dependencies.jar to /root/.m2/repository/com/deem/zkui/2.0-SNAPSHOT/zkui-2.0-SNAPSHOT-jar-with-dependencies.jar[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 17.670 s[INFO] Finished at: 2019-04-15T09:57:44+08:00[INFO] ------------------------------------------------------------------------

编译成功后,会生成两个jar包,zkui-2.0-SNAPSHOT.jar 和zkui-2.0-SNAPSHOT-jar-with-dependencies.jar。使用的是第二个jar包。

[root@localhost zkui]# cd target[root@localhost target]# ll总用量 8420drwxr-xr-x. 2 root root 6 8月 12 10:57 archive-tmpdrwxr-xr-x. 5 root root 101 8月 12 10:57 classesdrwxr-xr-x. 4 root root 49 8月 12 10:57 generated-sourcesdrwxr-xr-x. 2 root root 28 8月 12 10:57 maven-archiver-rw-------. 1 root root 355 8月 12 11:14 nohup.outdrwxr-xr-x. 2 root root 6 8月 12 10:57 surefiredrwxr-xr-x. 2 root root 89 8月 12 10:57 surefire-reportsdrwxr-xr-x. 3 root root 17 8月 12 10:57 test-classes-rw-r--r--. 1 root root 277164 8月 12 10:57 zkui-2.0-SNAPSHOT.jar-rw-r--r--. 1 root root 8336868 8月 12 10:57 zkui-2.0-SNAPSHOT-jar-with-dependencies.jar-rw-r--r--. 1 root root 0 8月 12 11:09 zkui-out.log[root@localhost target]#

2.3、修改配置文件

修改zkui的配置文件 config.cfg ,config.cfg 文件中配置了 zkui 需要连接的 zookeeper 集群的 IP 地址和端口,访问 zkui 的用户名和密码,以及 zkui 监听的端口号。

#Server PortserverPort=9090#Comma seperated list of all the zookeeper serverszkServer=192.168.1.192:2181,localhost:2181#Http path of the repository. Ignore if you dont intent to upload files from repository.scmRepo=http://myserver.com/@rev1=#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=falseldapDomain=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=prodjdbcClass=org.h2.DriverjdbcUrl=jdbc:h2:zkuijdbcUser=rootjdbcPwd=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=managerloginMessage=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=falsekeystoreFile=/home/user/keystore.jkskeystorePwd=passwordkeystoreManagerPwd=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 proxyX-Forwarded-For=false

注意:

  • 如果zookeeper和zkui安装在同一台机器上,不需要修改config.cfg 配置文件也可启动。
  • 默认用户信息:账号 root,密码 manager (Admin权限,支持CRUD操作)账号 appconfig ,密码 appconfig (Readonly权限,支持读取操作)
  • LDAP的配置如果想使用 LDAP 身份验证,则提供 LDAP url。这将优先于 roleSet property 文件认证。ldapUrl=ldap://<ldap_host>:<ldap_port>/dc=mycom,dc=com如果不提供此功能,则将使用默认 roleSet 文件认证。

2.4、启动zkui

[root@localhost zkui]# nohup java -jar target/zkui-2.0-SNAPSHOT-jar-with-dependencies.jar &[2] 1948[root@localhost zkui]# nohup: 忽略输入并把输出追加到"nohup.out"nohup: ignoring input and appending output to ‘nohup.out’-bash: nohup:: 未找到命令[root@localhost zkui]# netstat -tunpl |grep :9090tcp6 0 0 :::9090 :::* LISTEN 1694/java[root@localhost zkui]#

浏览器访问 http://192.168.1.192:9090/login 账号admin,密码manager 即可看到zkui的管理界面。

(注意开放端口9090,访问之前注意关闭防火墙)

zookeeper可视化界面zkui搭建与配置_maven

 

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  pfl0iGEgXbv6   2023年11月19日   20   0   0 git用户名bc
  xEqRD9hV9woQ   2023年11月14日   28   0   0 shelljavajar
  P3nxyT0LRuwj   2023年11月19日   26   0   0 javawar包jar
  Ogzy9ibNXM9w   2023年11月19日   20   0   0 gitnginxbc
  48fXx4UfWSFg   2023年12月06日   54   0   0 bcIPbundle