IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 大数据 -> Zookeeper 终端命令 -> 正文阅读

[大数据]Zookeeper 终端命令

一、服务端命令

1、启动Zookeeper服务命令

zkServer.sh start

执行结果:

ZooKeeper JMX enabled by default
Using config: /Users/davis/soft/zookeeper-3.6.3/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

2、查看Zookeeper状态命令

zkServer.sh status

执行结果:

ZooKeeper JMX enabled by default
Using config: /Users/davis/soft/zookeeper-3.6.3/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: standalone

3、停止Zookeeper服务命令

zkServer.sh start

4、启动Zookeeper客户端命令

zkCli.sh -server 127.0.0.1:1281

执行结果:

Connecting to localhost
2022-03-04 17:10:23,677 [myid:] - INFO  [main:Environment@98] - Client environment:zookeeper.version=3.6.3--6401e4ad2087061bc6b9f80dec2d69f2e3c8660a, built on 04/08/2021 16:35 GMT
2022-03-04 17:10:23,681 [myid:] - INFO  [main:Environment@98] - Client environment:host.name=10.0.22.112
2022-03-04 17:10:23,681 [myid:] - INFO  [main:Environment@98] - Client environment:java.version=1.8.0_121
2022-03-04 17:10:23,683 [myid:] - INFO  [main:Environment@98] - Client environment:java.vendor=Oracle Corporation
2022-03-04 17:10:23,684 [myid:] - INFO  [main:Environment@98] - Client environment:java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre
2022-03-04 17:10:23,684 [myid:] - INFO  [main:Environment@98] - Client environment:java.class.path=/Users/davis/soft/zookeeper-3.6.3/bin/../zookeeper-server/target/classes:/Users/davis/soft/zookeeper-3.6.3/bin/../build/classes:/Users/davis/soft/zookeeper-3.6.3/bin/../zookeeper-server/target/lib/*.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../build/lib/*.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/zookeeper-prometheus-metrics-3.6.3.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/zookeeper-jute-3.6.3.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/zookeeper-3.6.3.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/snappy-java-1.1.7.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/slf4j-log4j12-1.7.25.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/slf4j-api-1.7.25.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/simpleclient_servlet-0.6.0.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/simpleclient_hotspot-0.6.0.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/simpleclient_common-0.6.0.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/simpleclient-0.6.0.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/netty-transport-native-unix-common-4.1.63.Final.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/netty-transport-native-epoll-4.1.63.Final.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/netty-transport-4.1.63.Final.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/netty-resolver-4.1.63.Final.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/netty-handler-4.1.63.Final.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/netty-common-4.1.63.Final.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/netty-codec-4.1.63.Final.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/netty-buffer-4.1.63.Final.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/metrics-core-3.2.5.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/log4j-1.2.17.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/json-simple-1.1.1.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/jline-2.14.6.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/jetty-util-ajax-9.4.39.v20210325.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/jetty-util-9.4.39.v20210325.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/jetty-servlet-9.4.39.v20210325.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/jetty-server-9.4.39.v20210325.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/jetty-security-9.4.39.v20210325.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/jetty-io-9.4.39.v20210325.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/jetty-http-9.4.39.v20210325.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/javax.servlet-api-3.1.0.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/jackson-databind-2.10.5.1.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/jackson-core-2.10.5.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/jackson-annotations-2.10.5.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/commons-cli-1.2.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../lib/audience-annotations-0.5.0.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../zookeeper-*.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../zookeeper-server/src/main/resources/lib/*.jar:/Users/davis/soft/zookeeper-3.6.3/bin/../conf:
2022-03-04 17:10:23,684 [myid:] - INFO  [main:Environment@98] - Client environment:java.library.path=/Users/davis/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
2022-03-04 17:10:23,684 [myid:] - INFO  [main:Environment@98] - Client environment:java.io.tmpdir=/var/folders/5n/6g464jd97r13x39t5w69ybfr0000gn/T/
2022-03-04 17:10:23,684 [myid:] - INFO  [main:Environment@98] - Client environment:java.compiler=<NA>
2022-03-04 17:10:23,684 [myid:] - INFO  [main:Environment@98] - Client environment:os.name=Mac OS X
2022-03-04 17:10:23,685 [myid:] - INFO  [main:Environment@98] - Client environment:os.arch=x86_64
2022-03-04 17:10:23,685 [myid:] - INFO  [main:Environment@98] - Client environment:os.version=10.15.5
2022-03-04 17:10:23,685 [myid:] - INFO  [main:Environment@98] - Client environment:user.name=davis
2022-03-04 17:10:23,685 [myid:] - INFO  [main:Environment@98] - Client environment:user.home=/Users/davis
2022-03-04 17:10:23,685 [myid:] - INFO  [main:Environment@98] - Client environment:user.dir=/Users/davis/soft/zookeeper-3.6.3
2022-03-04 17:10:23,685 [myid:] - INFO  [main:Environment@98] - Client environment:os.memory.free=237MB
2022-03-04 17:10:23,687 [myid:] - INFO  [main:Environment@98] - Client environment:os.memory.max=245MB
2022-03-04 17:10:23,687 [myid:] - INFO  [main:Environment@98] - Client environment:os.memory.total=245MB
2022-03-04 17:10:23,692 [myid:] - INFO  [main:ZooKeeper@1006] - Initiating client connection, connectString=localhost sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@5aaa6d82
2022-03-04 17:10:23,695 [myid:] - INFO  [main:X509Util@77] - Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
2022-03-04 17:10:23,705 [myid:] - INFO  [main:ClientCnxnSocket@239] - jute.maxbuffer value is 1048575 Bytes
2022-03-04 17:10:23,712 [myid:] - INFO  [main:ClientCnxn@1736] - zookeeper.request.timeout value is 0. feature enabled=false
Welcome to ZooKeeper!
2022-03-04 17:10:23,720 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1181] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181.
2022-03-04 17:10:23,721 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2022-03-04 17:10:23,778 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1013] - Socket connection established, initiating session, client: /0:0:0:0:0:0:0:1:63550, server: localhost/0:0:0:0:0:0:0:1:2181
2022-03-04 17:10:23,810 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1448] - Session establishment complete on server localhost/0:0:0:0:0:0:0:1:2181, session id = 0x1005b53cb000000, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
[zk: localhost(CONNECTED) 0]

二、客户端命令

执行客户端命令前,首先要执行「启动Zookeeper客户端命令」启动客户端。

1、查看帮助

help

执行结果:

ZooKeeper -server host:port -client-configuration properties-file cmd args
	addWatch [-m mode] path # optional mode is one of [PERSISTENT, PERSISTENT_RECURSIVE] - default is PERSISTENT_RECURSIVE
	addauth scheme auth
	close
	config [-c] [-w] [-s]
	connect host:port
	create [-s] [-e] [-c] [-t ttl] path [data] [acl]
	delete [-v version] path
	deleteall path [-b batch size]
	delquota [-n|-b] path
	get [-s] [-w] path
	getAcl [-s] path
	getAllChildrenNumber path
	getEphemerals path
	history
	listquota path
	ls [-s] [-w] [-R] path
	printwatches on|off
	quit
	reconfig [-s] [-v version] [[-file path] | [-members serverID=host:port1:port2;port3[,...]*]] | [-add serverId=host:port1:port2;port3[,...]]* [-remove serverId[,...]*]
	redo cmdno
	removewatches path [-c|-d|-a] [-l]
	set [-s] [-v version] path data
	setAcl [-s] [-v version] [-R] path acl
	setquota -n|-b val path
	stat [-w] path
	sync path
	version
Command not found: Command not found help

2、查看当前znode所包含的内容

ls /

执行结果:

[username, zookeeper]

3、创建znode

create /username davis

执行结果:

Created /username

4、创建短暂znode

create -e /duanzan davis-duanzan

执行结果:

Created /duanzan

5、创建带序号znode

create -s /xuhao davis-xuhao

执行结果:

Created /xuhao0000000003

6、创建短暂带序号znode

create -e -s /duanzanxuhao davis-duanzanxuhao

执行结果:

Created /duanzanxuhao0000000004

7、获取znode数据

get /username

执行结果:

davis

8、修改znode数据

set /username davis-1

9、删除znode

delete /username

10、查看znode状态

stat /

执行结果:

cZxid = 0x0
ctime = Thu Jan 01 08:00:00 CST 1970
mZxid = 0x0
mtime = Thu Jan 01 08:00:00 CST 1970
pZxid = 0xd
cversion = 6
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 0
numChildren = 4

  大数据 最新文章
实现Kafka至少消费一次
亚马逊云科技:还在苦于ETL?Zero ETL的时代
初探MapReduce
【SpringBoot框架篇】32.基于注解+redis实现
Elasticsearch:如何减少 Elasticsearch 集
Go redis操作
Redis面试题
专题五 Redis高并发场景
基于GBase8s和Calcite的多数据源查询
Redis——底层数据结构原理
上一篇文章      下一篇文章      查看所有文章
加:2022-03-06 13:08:12  更:2022-03-06 13:10:12 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/24 10:27:53-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码