kafka

啓動 zookeepernode

一、./zkServer restart服務器

啓動kafaka性能

二、./kafka-server-start /usr/local/etc/kafka/server.properties測試

 

建立topicspa

三、./kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic testrest

查詢topic 列表code

四、 ./kafka-topics --list --zookeeper localhost:2181server

 

 

Zookeeper

啓動ZK服務blog

./zkServer start

 

查看ZK服務狀態get

bin/zkServer status

 

中止ZK服務

bin/zkServer stop

 

重啓ZK服務

bin/zkServer restart

 

鏈接服務器

bin/zkCli -server 127.0.0.1:2181

 

查看根目錄

ls /


建立 testnode節點

create /zk/testnode "test"

 

查看節點內容

get /zk/testnode


設置節點內容

set /zk/testnode test

 

刪除節點

delete /zk/testnode

 

 

 

 

 

性能測試

./kafka-producer-perf-test --messages 500000 --message-size 1000 --batch-size 500 --topics test --threads 2 --broker-list localhost:9092

bin/kafka-consumer-perf-test --zookeeper localhost:2181 --messages 500000 --topic test --threads 1

 

運行Producer並將Terminal輸入的消息發送到服務端

./kafka-console-producer --broker-list localhost:9092 --topic my-topic

<< This is a messageThis is another message

 

 

啓動Consumer讀取消息並輸出到標準輸出

./kafka-console-consumer --zookeeper localhost:2181 --topic my-topic --from-beginning

 

查看指定Topic狀態

./kafka-topics --describe --zookeeper localhost:2181 --topic my-topic

查看已存在Topic列表

./kafka-topics --list --zookeeper localhost:2181

 

新建Topic

./kafka-topics  --create --zookeeper localhost:2181 --replication-factor 3 --partitions 1 --topic my-topic
相關文章
相關標籤/搜索