kafka 0.8.1.1以及之前版本都無法使用類似一條命令就徹底刪除topic,此命令不過只是在zookeeper登出資訊而已,但是實際的日誌內容還是儲存在kafka log中,如果想徹底刪除topic,過程如下:
1、從zookeerer刪除資訊
./bin/kafka-run
-class
.sh kafka.admin.deletetopiccommand --zookeeper 10.0
.1.10:2181,10.0
.1.11:2181,10.0
.1.12:2181
--topic test
成功後返回資訊:deletion succeeded!
2、利用jps命令檢視kafka和zookeeper程序,kill掉quorumpeermain和kafka程序
3、從kafka的log
.dirs目錄刪除檔案,可以看到多個子目錄名字如test-
0,test-
1…test-n(就是你topic的partition個數)
進入到kafka的log
.dirs目錄,執行
rm –fr test-
0……test-n
4、修改日誌目錄的recovery-point
-offset
-checkpoint和replication-offset
-checkpoint檔案(要小心刪除,否則待會kafka不能正常啟動起來)
replication-offset
-checkpoint格式如下:
04(partition總數)
test 0
0 test 3
0 hehe 0
0 hehe 1
0修改後如下:
02(partition總數)
hehe 0
0 hehe 1
0把含有test行全部去掉,並且把partition總數修改為減去test的partition的剩餘數目,同理recovery-point
-offset
-checkpoint也是這樣修改。
完成後就可以正常啟動zookeeper和kafka。
從kafka 0.8
.2.1開始可以直接刪除topic,步驟如下:
kafka 0.8
.1.1之前版本,kafka-topics
.sh命令連--delete delete a topic引數都沒有,如下:
可使用如下命令 ./kafka-topics
.sh --help檢視
command must include exactly one action: –list, –describe, –create or –alter
option description
—— ———–
–alter alter the configuration for the topic.
–config
在之後的版本增加了這個delete項
option description
—— ———–
–alter alter the number of partitions,
replica assignment, and/or
configuration for the topic.
–config
當前測試版本0.10
.0.0
刪除過程:
1、在kafka配置檔案server.properties中新增刪除引數
delete.topic
.enable=true
2、利用命令刪除需要刪除的topic
bin/kafka-topics.sh --zookeeper zk_host:port/chroot --delete --topic my_topic_name
版本不一樣,刪除方法不一樣,最好是公升級到新版較穩定的比較好
如何在Kafka上建立乙個Topic
bin kafka topics.sh zookeeper 192.168.2.225 2183 config mobile mq create topic test.example replication factor 2 partitions 24 topic指定topic name parti...
git 從分支上建立乙個分支
從分支上建立乙個分支 1.先轉殖乙個專案 git clone2.再轉移到分支中 git status 位於分支 master 您的分支與上游分支 origin master 一致。無檔案要提交,乾淨的工作區 git checkout gaodian 分支 gaodian 設定為跟蹤來自 origin...
要求做乙個從網頁上匯入excel
網上文章,僅作學習之用,向作者表示感謝 要求做乙個從網頁上匯入excel,開始著手去實現它。思路很簡單 1 做乙個jsp頁面,頁面包括瀏覽檔案,提交檔案 2 將excel檔案上傳到伺服器 3 伺服器對該excel檔案進行讀出 4 將excel檔案內容顯示到頁面上 環境搭建 需要準備的包 common...