Introduction to Pulsarctl 0.3.0

Sijia-w
StreamNative
Published in
4 min readFeb 27, 2020

We are happy to announce that Pulsarctl 0.3.0 is out!

This release introduces various powerful features, such as you can use context to switch among multiple clusters, generate tokens with multiple methods, perform operations against BookKeeper, and so on.

For details and the download link, see Pulsarctl 0.3.0.

New feature

Pulsarctl 0.3.0 supports the following features.

Use context to switch among multiple clusters

In multi-cluster, context is a pretty useful function. It not only caches information of multiple clusters but also helps switch among multiple clusters conveniently. Besides, Pulsarctl 0.3.0 stores your cluster configuration to the context so that you can get or set the cluster without specifying the client configuration, such as admin-servicr-url and so on.

Example

This example shows how to use context to switch between two clusters, uses two standalone Pulsar in Dockers, and exposes them to different ports.

1. Create contexts for the two environments.

2. Show all contexts.

3. Create two different topics in these two environments.

4. Use the context env-e01b16d19f65 to list all topics.

5. Use the context env-304a37ba1b63 to list all topics.

Tip: for more operations about pulsarctl context, see How to use Pulsarctl context.

Support generate token

Pulsarctl 0.3.0 supports generate a token with multiple methods.

For the complete command list, run the pulsarctl token --help command.

Example

This example uses a secret key to generate a token. You can use other methods to generate tokens as well.

1. Create a secret key.

Tip: you can use -o to put the secret key to a file and use --base64 to get a base64 encoded secret key. These arguments are optional.

2. Use this secret key to create a token with the subject foo.

3. Show the token content.

Perform operations against BookKeeper

Pulsarctl 0.3.0 supports perform some operations against BookKeeper. For the complete command list, run the pulsarctl bookkeeper command.

Example

This example uses the BookKeeper auto-recovery command.

1. Get all available auto-recovery commands.

2. Get the lost bookie recovery delay value.

Improvement

Pulsarctl 0.3.0. introduces the following enhancements.

  • When using Pulsarctl in a cluster with proxy, you might get IllegalArgumentException after running some Pulsarctl commands. This is caused by setting the content type if there is no HTTP body.
  • Fix the issue of when using Pulsarctl peek messages, the Pulsar header is changed so that we can not read all the properties of the message.
  • Support use homebrew to download the Pulsarctl. You can install Pulsarctl by running the command brew tap streamnative/streamnative && brew install pulsarctl.

Contribute to Pulsarctl

In the contribution journey, you can learn more about Pulsarctl and Apache Pulsar. Any of your contributions to code or documentation is highly appreciated.

If you have any questions in Pulsarctl, feel free to contact us.

About the author

Yong Zhang is an Apache Pulsar contributor. He works as a software engineer at StreamNative.

Like this post? Please recommend and/or share.

Want to learn more? See https://streamnative.io/blog. Follow us here on Medium and check out our GitHub.

--

--