Pulsar常用命令记录

记录工作学习中常用到的Pulsar命令。
持续更新中… …

一、日常常用

  1. 删除Topic
bin/pulsar-admin topics delete  persistent://public/xxx命名空间/xxxTopic名称
  1. 创建Topic
bin/pulsar-admin topics create persistent://public/xxx命名空间/xxxTopic名称
  1. 查看Topic
bin/pulsar-admin topics stats persistent://public/xxx命名空间/xxxTopic名称
  1. 查看Topic内部状态
bin/pulsar-admin topics stats-internal persistent://public/xxx命名空间/xxxTopic名称
  1. 删除Topic下的订阅
bin/pulsar-admin topics unsubscribe -s "订阅名称" persistent://public/xxx命名空间/xxxTopic名称
  1. 清空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
这条命令还没有试验过… …

二、项目常用

  1. 查看pulsar broker zookeeper bookkeeper进程
ps -eaf | grep pulsar

如果 broker、zookeeper、bookkeeper进程正常,则集群正常

  1. 查看集群存活的bookkeeper
bin/bookkeeper shell listbookies -readwrite 
  1. 启动bookkeeper进程
bin/pulsar-daemon start bookie
  1. 测试生产10条消息
bin/pulsar-client produce persistent://public/default/test -n 10  -m "hello pulsar" 
  1. 测试消费10条消息
bin/pulsar-client consume persistent://public/default/test -n 10 -s "consumer-test" 

猜你喜欢

转载自blog.csdn.net/weixin_52799373/article/details/127356783