Pulsar common command record

Record the Pulsar commands commonly used in work and study.
Continuously updating...  

1. Daily use

  1. Delete Topic
bin/pulsar-admin topics delete  persistent://public/xxx命名空间/xxxTopic名称
  1. Create Topics
bin/pulsar-admin topics create persistent://public/xxx命名空间/xxxTopic名称
  1. View Topics
bin/pulsar-admin topics stats persistent://public/xxx命名空间/xxxTopic名称
  1. View the internal status of Topic
bin/pulsar-admin topics stats-internal persistent://public/xxx命名空间/xxxTopic名称
  1. Delete the subscription under the topic
bin/pulsar-admin topics unsubscribe -s "订阅名称" persistent://public/xxx命名空间/xxxTopic名称
  1. Clear 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
This command has not been tested yet... …

2. Commonly used items

  1. View pulsar broker zookeeper bookkeeper process
ps -eaf | grep pulsar

If the processes of broker, zookeeper and bookkeeper are normal, the cluster is normal

  1. View the surviving bookkeepers in the cluster
bin/bookkeeper shell listbookies -readwrite 
  1. Start the bookkeeper process
bin/pulsar-daemon start bookie
  1. Test production 10 messages
bin/pulsar-client produce persistent://public/default/test -n 10  -m "hello pulsar" 
  1. Test consumption of 10 messages
bin/pulsar-client consume persistent://public/default/test -n 10 -s "consumer-test" 

Guess you like

Origin blog.csdn.net/weixin_52799373/article/details/127356783