This quick reference covers
pulsarctl syntax, describes the command operations, and provides common examples. For details about each command, including all the supported flags and subcommands, see the pulsarctl reference documentation.
For installation instructions, see Installing pulsarctl.
Use the following syntax to run
pulsarctl command from your terminal window:
pulsarctl [resource] [command] [name] [flags]
resource: Specifies the resource type. Resource types are case-insensitive and you can specify the singular, plural, or abbreviated forms. For example, the following commands produce the same output:
pulsarctl topics get mytopic pulsarctl topic get mytopic
command: Specifies the operation that you want to perform one one or more resources, for example
name: Specifies the name of the resource. Names are case-sensitive.
flags: Specifies optional flags. For example, you can use the
--outputflags to specify the output format of a
Flags that you specify from the command line override default values and any corresponding environment variables.
If you need help, run
pulsarctl help from the terminal window.
Resource types (
The following table includes a list of all the supported resource types and their descriptions.
The following table includes the descriptions for
|Operations about BookKeeper. In order to interact with the bookkeeper cluster, you need to specify
--bookie-service-url when creating a context and make sure you are able to connect to the bookkeeper cluster via the specified service url.
|Operations to collect broker statistics
|Operations about broker(s)
|Operations about Pulsar cluster(s)
|Operations about Pulsar topics
|Generates shell completion scripts
|Interface for setting and managing Pulsar Context(s)
|Interface for managing Pulsar Functions (lightweight, Lambda-style compute processes that work with Pulsar)
|Operations to collect function-worker statistics
|Operations about namespaces
|Operations about namespace isolation policy
|Operations about oauth2
|Operations about packages
|Operations about plugins
|Operations about resource quotas
|Operations related to Schemas associated with Pulsar topics
|Interface for managing Pulsar IO sinks (egress data from Pulsar)
|Interface for managing Pulsar IO Sources (ingress data into Pulsar)
|Check service(broker or proxy) status
|Operations about subscription(s)
|Operations about tenant(s)
|Operations of token
|Operations about topic(s)
Specifies the operation to be performed on one or more resources. This argument is required. Common operations include
To learn more about command operations, see the pulsarctl reference documentation.
Resource Name (
Specifies the name of the
resource. This argument is required.
name is case-sensitive.
pulsarctl topics list public/default, where
pulsar/default is the namespace name.
Specifies the flags. This argument is optional.
For example, you can use the
--admin-service-url flags to specify the address and port of the admin web service URL that pulsarctl connects to.
Flags that you specify from the command line override the default values and corresponding environment variables.
- If you need help, run
pulsarctl helpfrom the terminal window.
- For more information about pulsarctl, see [pulsarctl](link to pulsarctl website).
Use the following sections for information about how you can format the output of certain commands. For details about which commands support the various output options, see the pulsarctl reference documentation.
The default output format for all
pulsarctl commands is the human readable plain-text format. To output details to your terminal window in a specific format, you can add either the
--output flags to a supported
pulsarctl [resource] [command] [name] -o <output_format>
Depending on the
pulsarctl operation, the following output formats are supported:
|Output a JSON formatted result.
|Output a YAML formatted result.
|Output a humand-readable result.
Enabling shell autocompletion
pulsarctl provides autocompletion support for Bash, Zsh, and Fish, which can save you a lot of typing.
The pulsarctl completion script for Zsh can be generated with the command
pulsarctl completion zsh. Sourcing the completion script in your shell enables pulsarctl autocompletion.
To configure your zsh shell, run:
mkdir -p ~/.zsh/completion/
pulsarctl completion zsh > ~/.zsh/completion/_pulsarctl
Include the directory in your $fpath, for example by adding in ~/.zshrc:
You may have to force rebuild zcompdump:
rm -f ~/.zcompdump; compinit
The pulsarctl completion script for Bash can be generated with
pulsarctl completion bash. Sourcing this script in your shell enables pulsarctl completion.
However, the pulsarctl completion script depends on
bash-completion which you thus have to previously install.
Warning: there are two versions of bash-completion, v1 and v2. V1 is for Bash 3.2 (which is the default on macOS), and v2 is for Bash 4.1+. The pulsarctl completion script doesn’t work correctly with bash-completion v1 and Bash 3.2. It requires bash-completion v2 and Bash 4.1+. Thus, to be able to correctly use pulsarctl completion on macOS, you have to install and use Bash 4.1+ (instructions). The following instructions assume that you use Bash 4.1+ (that is, any Bash version of 4.1 or newer).
Note: As mentioned, these instructions assume you use Bash 4.1+, which means you will install bash-completion v2 (in contrast to Bash 3.2 and bash-completion v1, in which case pulsarctl completion won’t work).
You can test if you have bash-completion v2 already installed with
brew list | grep bash. If not, you can install it with Homebrew:
brew install bash-completion@2
As stated in the output of this command, add the following to your ~/.bashrc file:
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
Enable pulsarctl autocompletion
You now have to ensure that the pulsarctl completion script gets sourced in all your shell sessions. There are multiple ways to achieve this:
- First, you can use
bashinto the bash shell.
Note: If you are using the bash shell, you can ignore it
- Add the completion script to the
pulsarctl completion bash >/usr/local/etc/bash_completion.d/pulsarctl.bash
- Source the completion script in your
echo 'source /usr/local/etc/bash_completion.d/pulsarctl.bash' >> ~/.bashrc
You can also use a shorthand alias for
pulsarctl that also works with completion:
complete -o default -F \_\_start_pulsarctl p
To load completions once in your current session run:
pulsarctl completion fish | source
To load completions for each session, run:
pulsarctl completion fish > ~/.config/fish/completions/pulsarctl.fish