Kafka启动:(根据自身路径更改)
/usr/local/kafka/bin/kafka-server-start.sh -daemon /usr/local/kafka/config/server.properties
Zookeeper启动:(根据自身路径更改)
/usr/local/zookeeper/bin/zkServer.sh start
进入客户端的命令:{zookeeper目录}/bin/zkCli.sh
/usr/local/zookeeper/bin/zkCli.sh
以下是几个zookeeper客户端用的命令,不只kafka,其他任何注册到zookeeper的服务都可以使用这些命令。
1、ls
ls会显示该节点下的子节点信息
比如:ls /
[zk: localhost:2181(CONNECTED) 1] ls /[dubbo, log_dir_event_notification, isr_change_notification, zookeeper, admin, consumers, cluster, config, latest_producer_id_block, controller, brokers, controller_epoch]
#显示zookeeper根目录下的子节点,其中kafka的broker在zookeeper根目录注册了brokers节点
比如:ls /brokers/topics/lockcar_loction/partitions
[zk: localhost:2181(CONNECTED) 2] ls /brokers/topics/lockcar_loction/partitions[1, 0]
#显示lockcar_loction这个topic下的partitions的子节点
2、get
get命令会显示该节点的节点数据内容和属性信息
比如:get /brokers/topics/lockcar_loction
[zk: localhost:2181(CONNECTED) 2] get /brokers/topics/lockcar_loction{"version":1,"partitions":{"1":[1],"0":[3]}}cZxid = 0x5000000cfctime = Wed Apr 08 09:12:12 CST 2020mZxid = 0x5000000cfmtime = Wed Apr 08 09:12:12 CST 2020pZxid = 0x5000000d2cversion = 1dataVersion = 0aclVersion = 0ephemeralOwner = 0x0dataLength = 44numChildren = 1
#显示lockcar_loction这个topic的节点数据内容和属性信息。
#第一行大括号里面就是节点的数据内容,创建topic时候的定义的topic级别配置会被记录在这里
3、ls2
ls2命令会显示该节点的子节点信息和属性信息
比如:ls2 /brokers/topics/lockcar_loction
[zk: localhost:2181(CONNECTED) 4] ls2 /brokers/topics/lockcar_loction[partitions]cZxid = 0x5000000cfctime = Wed Apr 08 09:12:12 CST 2020mZxid = 0x5000000cfmtime = Wed Apr 08 09:12:12 CST 2020pZxid = 0x5000000d2cversion = 1dataVersion = 0aclVersion = 0ephemeralOwner = 0x0dataLength = 44numChildren = 1
#显示lockcar_loction这个topic的子节点和属性信息。
#第一行中括号里的是子节点。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。