Zookeeper_Zookeeper客户端连接(含集群方式)

  zookeeper 连接地址,zookeeper 的连接方式多种多样,这里展示3种连接方式

1.命令行连接

2.jar程序连接

3.IDE 插件

 

一、zkCli.sh  / zookeeper-client  连接方式

命令行连接

zookeeper-client -server cdh-manager:2181,cdh-node1:2181,cdh-node2:2181

连接后的信息

[root@cdh-manager /]# zookeeper-client -server cdh-manager:2181,cdh-node1:2181,cdh-node2:2181
Connecting to cdh-manager:2181,cdh-node1:2181,cdh-node2:2181
2020-06-27 12:26:24,850 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.5-cdh6.0.1--1, built on 09/19/2018 15:15 GMT
2020-06-27 12:26:24,854 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=cdh-manager
2020-06-27 12:26:24,855 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.8.0_191
2020-06-27 12:26:24,857 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2020-06-27 12:26:24,857 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/opt/java_home/jdk1.8.0_191/jre
2020-06-27 12:26:24,857 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/lib/zookeeper/bin/../build/classes:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/lib/zookeeper/bin/../build/lib/*.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/lib/zookeeper/bin/../lib/slf4j-log4j12.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/lib/zookeeper/bin/../lib/slf4j-log4j12-1.7.25.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/lib/zookeeper/bin/../lib/slf4j-api-1.7.25.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/lib/zookeeper/bin/../lib/netty-3.10.6.Final.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/lib/zookeeper/bin/../lib/log4j-1.2.17.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/lib/zookeeper/bin/../lib/jline-2.11.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/lib/zookeeper/bin/../lib/audience-annotations-0.5.0.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/lib/zookeeper/bin/../zookeeper-3.4.5-cdh6.0.1.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/lib/zookeeper/bin/../src/java/lib/*.jar:/etc/zookeeper/conf:.:/opt/java/lib/dt.jar:/opt/java/lib/tools.jar:/etc/zookeeper/conf:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/bin/../lib/zookeeper/zookeeper.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/bin/../lib/zookeeper/zookeeper-3.4.5-cdh6.0.1.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/bin/../lib/zookeeper/lib/slf4j-log4j12.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/bin/../lib/zookeeper/lib/log4j-1.2.17.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/bin/../lib/zookeeper/lib/audience-annotations-0.5.0.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/bin/../lib/zookeeper/lib/slf4j-log4j12-1.7.25.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/bin/../lib/zookeeper/lib/jline-2.11.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/bin/../lib/zookeeper/lib/slf4j-api-1.7.25.jar:/opt/cloudera/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678/bin/../lib/zookeeper/lib/netty-3.10.6.Final.jar
2020-06-27 12:26:24,857 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2020-06-27 12:26:24,857 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2020-06-27 12:26:24,857 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=
2020-06-27 12:26:24,857 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
2020-06-27 12:26:24,857 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
2020-06-27 12:26:24,858 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=3.10.0-957.1.3.el7.x86_64
2020-06-27 12:26:24,858 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=root
2020-06-27 12:26:24,858 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/root
2020-06-27 12:26:24,858 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/
2020-06-27 12:26:24,860 [myid:] - INFO  [main:ZooKeeper@442] - Initiating client connection, connectString=cdh-manager:2181,cdh-node1:2181,cdh-node2:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@506c589e
2020-06-27 12:26:24,894 [myid:] - INFO  [main-SendThread(cdh-node2:2181):ClientCnxn$SendThread@967] - Opening socket connection to server cdh-node2/192.168.75.132:2181. Will not attempt to authenticate using SASL (unknown error)
Welcome to ZooKeeper!
JLine support is enabled
2020-06-27 12:26:24,990 [myid:] - INFO  [main-SendThread(cdh-node2:2181):ClientCnxn$SendThread@844] - Socket connection established, initiating session, client: /192.168.75.133:44202, server: cdh-node2/192.168.75.132:2181
2020-06-27 12:26:25,006 [myid:] - INFO  [main-SendThread(cdh-node2:2181):ClientCnxn$SendThread@1227] - Session establishment complete on server cdh-node2/192.168.75.132:2181, sessionid = 0x172f3ac6c53009c, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null

 

二、ZooInspector

下载地址:https://issues.apache.org/jira/secure/attachment/12436620/ZooInspector.zip

(1)解压

Zookeeper_Zookeeper客户端连接(含集群方式)_第1张图片

(2)双击执行

Zookeeper_Zookeeper客户端连接(含集群方式)_第2张图片

(3)链接

Zookeeper_Zookeeper客户端连接(含集群方式)_第3张图片

localhost:zookeeper部署服务器IP

2181:zokeeper端口

(4)成功链接

Zookeeper_Zookeeper客户端连接(含集群方式)_第4张图片

 

三、Eclipse插件

 

(1)安装插件

在 Eclipse  菜单打开Help -> Install New Software... 

 

(2)添加 url

http://www.massedynamic.org/eclipse/updates/

Zookeeper_Zookeeper客户端连接(含集群方式)_第5张图片

 Zookeeper_Zookeeper客户端连接(含集群方式)_第6张图片

 

(3)安装成功

在 Eclipse  菜单打开Window->Show View->Other>ZooKeeper 3.2.2 

 

Zookeeper_Zookeeper客户端连接(含集群方式)_第7张图片

 

 

(4)链接

Zookeeper_Zookeeper客户端连接(含集群方式)_第8张图片

Zookeeper_Zookeeper客户端连接(含集群方式)_第9张图片 

Zookeeper_Zookeeper客户端连接(含集群方式)_第10张图片

Zookeeper_Zookeeper客户端连接(含集群方式)_第11张图片

Zookeeper_Zookeeper客户端连接(含集群方式)_第12张图片

你可能感兴趣的:(Zookeeper)