记录工作学习中常用到的Pulsar命令。
持续更新中… …
一、日常常用
- 删除Topic
bin/pulsar-admin topics delete persistent://public/xxx命名空间/xxxTopic名称
- 创建Topic
bin/pulsar-admin topics create persistent://public/xxx命名空间/xxxTopic名称
- 查看Topic
bin/pulsar-admin topics stats persistent://public/xxx命名空间/xxxTopic名称
- 查看Topic内部状态
bin/pulsar-admin topics stats-internal persistent://public/xxx命名空间/xxxTopic名称
- 删除Topic下的订阅
bin/pulsar-admin topics unsubscribe -s "订阅名称" persistent://public/xxx命名空间/xxxTopic名称
- 清空Topic
bin/pulsar-admin topics truncate persistent://public/xxx命名空间/xxxTopic名称
Truncate a topic. The truncate operation will move all cursors to
the end of the topic and delete all inactive ledgers. Usage: truncate
persistent://tenant/namespace/topic
这条命令还没有试验过… …
二、项目常用
- 查看pulsar broker zookeeper bookkeeper进程
ps -eaf | grep pulsar
如果 broker、zookeeper、bookkeeper进程正常,则集群正常
- 查看集群存活的bookkeeper
bin/bookkeeper shell listbookies -readwrite
- 启动bookkeeper进程
bin/pulsar-daemon start bookie
- 测试生产10条消息
bin/pulsar-client produce persistent://public/default/test -n 10 -m "hello pulsar"
- 测试消费10条消息
bin/pulsar-client consume persistent://public/default/test -n 10 -s "consumer-test"