zookeeper 有三种安装方式
1、单机模式,只是在一台服务器上运行一个 zookeeper 实例,适合学习测试用。
2、集群模式,在多台服务器上运行多个实例,各个实例之间通过网络连接互相通信,组成集群,适合生产环境。
3、伪集群模式,在一台服务器上运行多个实例,互相之间通过网络通信,组成集群,适合学习测试用。

安装环境

  • CentOS 7
  • java 11.0.10
  • zookeeper 3.8.0 点击下载
    在这里插入图片描述这里下载二进制包,而不是源码包,要不然还得自己编译。
    下载之后上传到服务器之后解压一下,如图
    在这里插入图片描述
    在这里插入图片描述
    进入到解压后的目录
  • bin 脚本文件目录,启动脚本,命令脚本
  • conf 配置文件目录
  • docs 文档目录
  • lib 运行依赖的一些 jar 包

单机模式安装

1、新建 standalone 目录

mkdir standalone

2、进入到 standalone 把解压的 zookeeper 复制进来,改名 zk

[root@localhost standalone]# cp -r ../apache-zookeeper-3.8.0-bin .
[root@localhost standalone]# ll
总用量 0
drwxr-xr-x. 6 root root 133 815 21:34 apache-zookeeper-3.8.0-bin
[root@localhost standalone]# mv apache-zookeeper-3.8.0-bin/ zk
[root@localhost standalone]# ll
总用量 0
drwxr-xr-x. 6 root root 133 815 21:34 zk
[root@localhost standalone]# 

3、进入到 配置文件目录,复制 zoo_sample.cfg 为 zoo.cfg

[root@localhost standalone]# cd zk/conf/
[root@localhost conf]# 
[root@localhost conf]# ll
总用量 16
-rw-r--r--. 1 root root  535 815 21:34 configuration.xsl
-rw-r--r--. 1 root root 4559 815 21:34 logback.xml
-rw-r--r--. 1 root root 1183 815 21:34 zoo_sample.cfg
[root@localhost conf]# cp zoo_sample.cfg zoo.cfg        
[root@localhost conf]# ll
总用量 20
-rw-r--r--. 1 root root  535 815 21:34 configuration.xsl
-rw-r--r--. 1 root root 4559 815 21:34 logback.xml
-rw-r--r--. 1 root root 1183 815 21:37 zoo.cfg
-rw-r--r--. 1 root root 1183 815 21:34 zoo_sample.cfg
[root@localhost conf]# 

4、修改 zoo.cfg 配置文件

[root@localhost conf]# vim zoo.cfg 

在这里插入图片描述
这里主要修改了 dataDir(用来存放数据文件,版本文件)和 clientPort(端口号,用于客户端连接)

5、启动 zookeeper 服务

进入到 bin 目录下,执行 zkServer.sh 脚本文件

[root@localhost bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /home/tiger/zookeeper/standalone/zk/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost bin]# 

查看 zookeeper 运行状态

[root@localhost bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/tiger/zookeeper/standalone/zk/bin/../conf/zoo.cfg
Client port found: 12181. Client address: localhost. Client SSL: false.
Mode: standalone
[root@localhost bin]# 

停止服务

[root@localhost bin]# ./zkServer.sh stop
ZooKeeper JMX enabled by default
Using config: /home/tiger/zookeeper/standalone/zk/bin/../conf/zoo.cfg
Stopping zookeeper ... ./zkServer.sh: 第 219 行:kill: (3081) - 没有那个进程
STOPPED
[root@localhost bin]# 

6、客户端连接

重新启动 zookeeper 服务,使用 zkCli.sh 脚本连接 zookeeper 服务

[root@localhost bin]# ./zkServer.sh start 
ZooKeeper JMX enabled by default
Using config: /home/tiger/zookeeper/standalone/zk/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost bin]# ./zkCli.sh -server localhost:12181
Connecting to localhost:12181
2022-08-15 21:48:35,519 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:zookeeper.version=3.8.0-5a02a05eddb59aee6ac762f7ea82e92a68eb9c0f, built on 2022-02-25 08:49 UTC
2022-08-15 21:48:35,522 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:host.name=localhost
2022-08-15 21:48:35,522 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.version=11.0.10
2022-08-15 21:48:35,522 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.vendor=Oracle Corporation
2022-08-15 21:48:35,522 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.home=/usr/local/workspace/javahome/jdk-11.0.10
2022-08-15 21:48:35,522 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.class.path=/home/tiger/zookeeper/standalone/zk/bin/../zookeeper-server/target/classes:/home/tiger/zookeeper/standalone/zk/bin/../build/classes:/home/tiger/zookeeper/standalone/zk/bin/../zookeeper-server/target/lib/*.jar:/home/tiger/zookeeper/standalone/zk/bin/../build/lib/*.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/zookeeper-prometheus-metrics-3.8.0.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/zookeeper-jute-3.8.0.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/zookeeper-3.8.0.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/snappy-java-1.1.7.7.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/slf4j-api-1.7.30.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/simpleclient_servlet-0.9.0.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/simpleclient_hotspot-0.9.0.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/simpleclient_common-0.9.0.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/simpleclient-0.9.0.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/netty-transport-native-unix-common-4.1.73.Final.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/netty-transport-native-epoll-4.1.73.Final.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/netty-transport-classes-epoll-4.1.73.Final.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/netty-transport-4.1.73.Final.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/netty-tcnative-classes-2.0.48.Final.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/netty-tcnative-2.0.48.Final.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/netty-resolver-4.1.73.Final.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/netty-handler-4.1.73.Final.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/netty-common-4.1.73.Final.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/netty-codec-4.1.73.Final.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/netty-buffer-4.1.73.Final.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/metrics-core-4.1.12.1.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/logback-core-1.2.10.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/logback-classic-1.2.10.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/jline-2.14.6.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/jetty-util-ajax-9.4.43.v20210629.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/jetty-util-9.4.43.v20210629.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/jetty-servlet-9.4.43.v20210629.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/jetty-server-9.4.43.v20210629.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/jetty-security-9.4.43.v20210629.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/jetty-io-9.4.43.v20210629.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/jetty-http-9.4.43.v20210629.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/javax.servlet-api-3.1.0.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/jackson-databind-2.13.1.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/jackson-core-2.13.1.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/jackson-annotations-2.13.1.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/commons-io-2.11.0.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/commons-cli-1.4.jar:/home/tiger/zookeeper/standalone/zk/bin/../lib/audience-annotations-0.12.0.jar:/home/tiger/zookeeper/standalone/zk/bin/../zookeeper-*.jar:/home/tiger/zookeeper/standalone/zk/bin/../zookeeper-server/src/main/resources/lib/*.jar:/home/tiger/zookeeper/standalone/zk/bin/../conf:/usr/local/workspace/javahome/jdk11/lib:/usr/local/workspace/javahome/jdk11/jre/lib:
2022-08-15 21:48:35,522 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.library.path=/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
2022-08-15 21:48:35,522 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.io.tmpdir=/tmp
2022-08-15 21:48:35,522 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.compiler=<NA>
2022-08-15 21:48:35,522 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.name=Linux
2022-08-15 21:48:35,522 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.arch=amd64
2022-08-15 21:48:35,523 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.version=3.10.0-514.el7.x86_64
2022-08-15 21:48:35,523 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:user.name=root
2022-08-15 21:48:35,523 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:user.home=/root
2022-08-15 21:48:35,523 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:user.dir=/home/tiger/zookeeper/standalone/zk/bin
2022-08-15 21:48:35,523 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.memory.free=80MB
2022-08-15 21:48:35,523 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.memory.max=256MB
2022-08-15 21:48:35,523 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.memory.total=92MB
2022-08-15 21:48:35,526 [myid:] - INFO  [main:o.a.z.ZooKeeper@637] - Initiating client connection, connectString=localhost:12181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@6ae5aa72
2022-08-15 21:48:35,541 [myid:] - INFO  [main:o.a.z.c.X509Util@77] - Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
2022-08-15 21:48:35,548 [myid:] - INFO  [main:o.a.z.ClientCnxnSocket@239] - jute.maxbuffer value is 1048575 Bytes
2022-08-15 21:48:35,557 [myid:] - INFO  [main:o.a.z.ClientCnxn@1732] - zookeeper.request.timeout value is 0. feature enabled=false
Welcome to ZooKeeper!
2022-08-15 21:48:35,618 [myid:localhost:12181] - INFO  [main-SendThread(localhost:12181):o.a.z.ClientCnxn$SendThread@1171] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:12181.
2022-08-15 21:48:35,620 [myid:localhost:12181] - INFO  [main-SendThread(localhost:12181):o.a.z.ClientCnxn$SendThread@1173] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2022-08-15 21:48:35,655 [myid:localhost:12181] - INFO  [main-SendThread(localhost:12181):o.a.z.ClientCnxn$SendThread@1005] - Socket connection established, initiating session, client: /0:0:0:0:0:0:0:1:59224, server: localhost/0:0:0:0:0:0:0:1:12181
2022-08-15 21:48:35,747 [myid:localhost:12181] - INFO  [main-SendThread(localhost:12181):o.a.z.ClientCnxn$SendThread@1444] - Session establishment complete on server localhost/0:0:0:0:0:0:0:1:12181, session id = 0x100000f7c940004, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:12181(CONNECTED) 0] ls /
[zookeeper]
[zk: localhost:12181(CONNECTED) 1] 

伪集群模式安装

在多台服务器上安装 zookeeper 集群可能没有条件,那么可以在单台服务器上安装 zookeeper 伪集群体验一把,一台机器上部署多个 zookeeper 实例,那么就得保证端口不能冲突,dataDir 也不能一样,另外,还得再 dataDir 对应的目录里新建 myid 文件用于唯一指定 zookeeper 实例。

1、新建集群目录,复制二进制包

[root@localhost zookeeper]# ll
总用量 12880
drwxr-xr-x. 6 root root      133 815 21:26 apache-zookeeper-3.8.0-bin
-rw-r--r--. 1 root root 13185104 815 21:12 apache-zookeeper-3.8.0-bin.tar.gz
drwxr-xr-x. 4 root root       28 815 21:40 standalone
[root@localhost zookeeper]# mkdir cluster
[root@localhost zookeeper]# ll
总用量 12880
drwxr-xr-x. 6 root root      133 815 21:26 apache-zookeeper-3.8.0-bin
-rw-r--r--. 1 root root 13185104 815 21:12 apache-zookeeper-3.8.0-bin.tar.gz
drwxr-xr-x. 2 root root        6 815 21:55 cluster
drwxr-xr-x. 4 root root       28 815 21:40 standalone
[root@localhost zookeeper]# cd cluster/
[root@localhost cluster]# cp -r ../apache-zookeeper-3.8.0-bin zk01
[root@localhost cluster]# ll
总用量 0
drwxr-xr-x. 6 root root 133 815 21:56 zk01
[root@localhost cluster]# 

2、创建 data 目录和 myid 文件

在 zk01 下创建 data 目录

[root@localhost cluster]# cd zk01/
[root@localhost zk01]# mkdir data
[root@localhost data]# echo 1 > myid
[root@localhost data]# ll
总用量 4
-rw-r--r--. 1 root root 2 815 22:04 myid
[root@localhost data]# cat myid 
1
[root@localhost data]# 

3、修改配置文件

[root@localhost zk01]# cd conf/
[root@localhost conf]# 
[root@localhost conf]# ll
  用量 16
-rw-r--r--. 1 root root  535 815 21:56 configuration.xsl
-rw-r--r--. 1 root root 4559 815 21:56 logback.xml
-rw-r--r--. 1 root root 1183 815 21:56 zoo_sample.cfg
[root@localhost conf]# cp zoo_sample.cfg zoo.cfg        
[root@localhost conf]# vim zoo.cfg 

在这里插入图片描述
在配置文件末尾添加如下配置

server.1=localhost:12881:13881
server.2=localhost:12882:13882
server.3=localhost:12883:13883
#server.服务器ID(myid文件里的值)=服务器IP地址:服务器之间通信端⼝:服务器之间投票选举端⼝

4、复制 zk01,产生 zk02,zk03 并修改配置文件,myid 文件

[root@localhost cluster]# ll
总用量 0
drwxr-xr-x. 7 root root 145 815 21:57 zk01
[root@localhost cluster]# cp -r zk01 zk02
[root@localhost cluster]# cp -r zk01 zk03
[root@localhost cluster]# ll
总用量 0
drwxr-xr-x. 7 root root 145 815 21:57 zk01
drwxr-xr-x. 7 root root 145 815 22:14 zk02
drwxr-xr-x. 7 root root 145 815 22:14 zk03
[root@localhost cluster]# 

5、启动集群

[root@localhost cluster]# ./zk01/bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /home/tiger/zookeeper/cluster/zk01/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost cluster]# ./zk02/bin/zkServer.sh start 
ZooKeeper JMX enabled by default
Using config: /home/tiger/zookeeper/cluster/zk02/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost cluster]# ./zk03/bin/zkServer.sh start 
ZooKeeper JMX enabled by default
Using config: /home/tiger/zookeeper/cluster/zk03/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost cluster]# ./zk03/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/tiger/zookeeper/cluster/zk03/bin/../conf/zoo.cfg
Client port found: 12183. Client address: localhost. Client SSL: false.
Mode: follower
[root@localhost cluster]# ./zk02/bin/zkServer.sh status 
ZooKeeper JMX enabled by default
Using config: /home/tiger/zookeeper/cluster/zk02/bin/../conf/zoo.cfg
Client port found: 12182. Client address: localhost. Client SSL: false.
Mode: leader
[root@localhost cluster]# ./zk01/bin/zkServer.sh status 
ZooKeeper JMX enabled by default
Using config: /home/tiger/zookeeper/cluster/zk01/bin/../conf/zoo.cfg
Client port found: 12181. Client address: localhost. Client SSL: false.
Mode: follower
[root@localhost cluster]# 

可以看到 3 个实例,两个角色是 follower,一个是 leader

6、客户端连接一下

[root@localhost cluster]# ./zk01/bin/zkCli.sh -server localhost:12183
Connecting to localhost:12183
2022-08-15 22:19:42,590 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:zookeeper.version=3.8.0-5a02a05eddb59aee6ac762f7ea82e92a68eb9c0f, built on 2022-02-25 08:49 UTC
2022-08-15 22:19:42,593 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:host.name=localhost
2022-08-15 22:19:42,593 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.version=11.0.10
2022-08-15 22:19:42,593 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.vendor=Oracle Corporation
2022-08-15 22:19:42,594 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.home=/usr/local/workspace/javahome/jdk-11.0.10
2022-08-15 22:19:42,594 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.class.path=/home/tiger/zookeeper/cluster/zk01/bin/../zookeeper-server/target/classes:/home/tiger/zookeeper/cluster/zk01/bin/../build/classes:/home/tiger/zookeeper/cluster/zk01/bin/../zookeeper-server/target/lib/*.jar:/home/tiger/zookeeper/cluster/zk01/bin/../build/lib/*.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/zookeeper-prometheus-metrics-3.8.0.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/zookeeper-jute-3.8.0.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/zookeeper-3.8.0.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/snappy-java-1.1.7.7.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/slf4j-api-1.7.30.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/simpleclient_servlet-0.9.0.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/simpleclient_hotspot-0.9.0.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/simpleclient_common-0.9.0.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/simpleclient-0.9.0.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/netty-transport-native-unix-common-4.1.73.Final.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/netty-transport-native-epoll-4.1.73.Final.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/netty-transport-classes-epoll-4.1.73.Final.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/netty-transport-4.1.73.Final.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/netty-tcnative-classes-2.0.48.Final.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/netty-tcnative-2.0.48.Final.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/netty-resolver-4.1.73.Final.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/netty-handler-4.1.73.Final.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/netty-common-4.1.73.Final.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/netty-codec-4.1.73.Final.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/netty-buffer-4.1.73.Final.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/metrics-core-4.1.12.1.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/logback-core-1.2.10.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/logback-classic-1.2.10.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/jline-2.14.6.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/jetty-util-ajax-9.4.43.v20210629.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/jetty-util-9.4.43.v20210629.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/jetty-servlet-9.4.43.v20210629.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/jetty-server-9.4.43.v20210629.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/jetty-security-9.4.43.v20210629.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/jetty-io-9.4.43.v20210629.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/jetty-http-9.4.43.v20210629.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/javax.servlet-api-3.1.0.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/jackson-databind-2.13.1.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/jackson-core-2.13.1.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/jackson-annotations-2.13.1.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/commons-io-2.11.0.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/commons-cli-1.4.jar:/home/tiger/zookeeper/cluster/zk01/bin/../lib/audience-annotations-0.12.0.jar:/home/tiger/zookeeper/cluster/zk01/bin/../zookeeper-*.jar:/home/tiger/zookeeper/cluster/zk01/bin/../zookeeper-server/src/main/resources/lib/*.jar:/home/tiger/zookeeper/cluster/zk01/bin/../conf:/usr/local/workspace/javahome/jdk11/lib:/usr/local/workspace/javahome/jdk11/jre/lib:
2022-08-15 22:19:42,594 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.library.path=/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
2022-08-15 22:19:42,594 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.io.tmpdir=/tmp
2022-08-15 22:19:42,594 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.compiler=<NA>
2022-08-15 22:19:42,594 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.name=Linux
2022-08-15 22:19:42,594 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.arch=amd64
2022-08-15 22:19:42,594 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.version=3.10.0-514.el7.x86_64
2022-08-15 22:19:42,594 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:user.name=root
2022-08-15 22:19:42,594 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:user.home=/root
2022-08-15 22:19:42,594 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:user.dir=/home/tiger/zookeeper/cluster
2022-08-15 22:19:42,594 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.memory.free=80MB
2022-08-15 22:19:42,595 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.memory.max=256MB
2022-08-15 22:19:42,595 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.memory.total=92MB
2022-08-15 22:19:42,629 [myid:] - INFO  [main:o.a.z.ZooKeeper@637] - Initiating client connection, connectString=localhost:12183 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@6ae5aa72
2022-08-15 22:19:42,634 [myid:] - INFO  [main:o.a.z.c.X509Util@77] - Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
2022-08-15 22:19:42,639 [myid:] - INFO  [main:o.a.z.ClientCnxnSocket@239] - jute.maxbuffer value is 1048575 Bytes
2022-08-15 22:19:42,648 [myid:] - INFO  [main:o.a.z.ClientCnxn@1732] - zookeeper.request.timeout value is 0. feature enabled=false
Welcome to ZooKeeper!
2022-08-15 22:19:42,696 [myid:localhost:12183] - INFO  [main-SendThread(localhost:12183):o.a.z.ClientCnxn$SendThread@1171] - Opening socket connection to server localhost/127.0.0.1:12183.
2022-08-15 22:19:42,698 [myid:localhost:12183] - INFO  [main-SendThread(localhost:12183):o.a.z.ClientCnxn$SendThread@1173] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2022-08-15 22:19:42,869 [myid:localhost:12183] - INFO  [main-SendThread(localhost:12183):o.a.z.ClientCnxn$SendThread@1005] - Socket connection established, initiating session, client: /127.0.0.1:42510, server: localhost/127.0.0.1:12183
2022-08-15 22:19:43,020 [myid:localhost:12183] - INFO  [main-SendThread(localhost:12183):o.a.z.ClientCnxn$SendThread@1444] - Session establishment complete on server localhost/127.0.0.1:12183, session id = 0x30000c948a30000, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:12183(CONNECTED) 0] ls /
[zookeeper]
[zk: localhost:12183(CONNECTED) 1] 

安装完成

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐