Pulsar command-line tools


Pulsar offers several command-line tools that you can use for managing Pulsar installations, performance testing, using command-line producers and consumers, and more.

All Pulsar command-line tools can be run from the bin directory of your installed Pulsar package. The following tools are currently documented:

Getting help

You can get help for any CLI tool, command, or subcommand using the --help flag, or -h for short. Here’s an example:

$ bin/pulsar-admin clusters --help

pulsar

The pulsar tool is used to start Pulsar components, such as bookies and ZooKeeper, in the foreground.

These processes can also be started in the background, using nohup, using the pulsar-daemon tool, which has the same command interface as pulsar.

Usage
$ pulsar command
Commands
Example
$ pulsar broker \
  --conf /path/to/broker.conf
Environment variables

The table below lists the environment variables that you can use to configure the pulsar tool.

Variable Description Default
PULSAR_LOG_CONF Log4j configuration file conf/log4j2.yaml
PULSAR_BROKER_CONF Configuration file for broker conf/broker.conf
PULSAR_BOOKKEEPER_CONF Configuration file for bookie conf/bookkeeper.conf
PULSAR_ZK_CONF Configuration file for zookeeper conf/zookeeper.conf
PULSAR_GLOBAL_ZK_CONF Configuration file for global zookeeper conf/global_zookeeper.conf
PULSAR_DISCOVERY_CONF Configuration file for discovery service conf/discovery.conf
PULSAR_WEBSOCKET_CONF Configuration file for websocket proxy conf/websocket.conf
PULSAR_STANDALONE_CONF Configuration file for standalone conf/standalone.conf
PULSAR_EXTRA_OPTS Extra options to be passed to the jvm
PULSAR_EXTRA_CLASSPATH Extra paths for Pulsar's classpath
PULSAR_PID_DIR Folder where the pulsar server PID file should be stored
PULSAR_STOP_TIMEOUT Wait time before forcefully killing the Bookie server instance if attempts to stop it are not successful

bookie

Starts up a bookie server

Usage
$ pulsar bookie options
Options
Flag Description Default
-c , --conf

Configuration for the bookie server

-readOnly

Force start a read-only bookie server

false
-withAutoRecovery

Start auto-recovery service bookie server

false
Example
$ pulsar bookie \
  -readOnly \
  -withAutoRecovery \
  --conf /path/to/bookkeeper.conf

broker

Starts up a Pulsar broker

Usage
$ pulsar broker options
Options
Flag Description Default
-c , --broker-conf

Configuration file for the broker

-bc , --bookie-conf

Configuration file for BookKeeper

-rb , --run-bookie

Run a BookKeeper bookie on the same host as the Pulsar broker

false
-ra , --run-bookie-autorecovery

Run a BookKeeper autorecovery daemon on the same host as the Pulsar broker

false
Example
$ pulsar broker \
  --conf /path/to/broker.conf

compact-topic

Run compaction against a Pulsar topic

Usage
$ pulsar compact-topic options
Options
Flag Description Default
-t , --topic

The Pulsar topic that you would like to compact

Example
$ pulsar compact-topic \
  --topic persistent://sample/standalone/ns1/topic-to-compact

discovery

Run a discovery server

Usage
$ pulsar discovery options
Options
Flag Description Default
-c , --conf

Configuration file for the discovery service

Example
$ pulsar discovery \
  --conf /path/to/discovery.conf

global-zookeeper

Starts up global ZooKeeper

Usage
$ pulsar global-zookeeper options
Options
Flag Description Default
-c , --conf

Configuration file for global ZooKeeper

initialize-cluster-metadata

One-time cluster metadata initialization

Usage
$ pulsar initialize-cluster-metadata options
Options
Flag Description Default
-ub , --broker-service-url

The broker service URL for the new cluster

-tb , --broker-service-url-tls

The broker service URL for the new cluster with TLS encryption

-c , --cluster

Cluster name

-gzk , --global-zookeeper

The global ZooKeeper quorum connection string

-uw , --web-service-url

The web service URL for the new cluster

-tw , --web-service-url-tls

The web service URL for the new cluster with TLS encryption

-zk , --zookeeper

The local ZooKeeper quorum connection string

proxy

Manages the Pulsar proxy

Usage
$ pulsar proxy options
Options
Flag Description Default
-c , --config

Path to a Pulsar proxy configuration file

-gzk , --global-zookeeper-servers

Global ZooKeeper connection string

-zk , --zookeeper-servers

Local ZooKeeper connection string

Example
$ pulsar proxy \
  --zookeeper-servers zk-0,zk-1,zk2 \
  --global-zookeeper-servers zk-0,zk-1,zk-2

standalone

Run a broker service with local bookies and local ZooKeeper

Usage
$ pulsar standalone options
Options
Flag Description Default
-a , --advertised-address

The standalone broker advertised address

--bookkeeper-dir

Local bookies’ base data directory

data/standalone/bookeeper
--bookkeeper-port

Local bookies’ base port

3181
-c , --config

Configuration file path

--no-broker

Only start ZooKeeper and BookKeeper services, not the broker

false
--num-bookies

The number of local bookies

1
--only-broker

Only start the Pulsar broker service (not ZooKeeper or BookKeeper)

--wipe-data

Clean up previous ZooKeeper/BookKeeper data

--zookeeper-dir

Local ZooKeeper’s data directory

data/standalone/zookeeper
--zookeeper-port

Local ZooKeeper’s port

2181

websocket

Usage
$ pulsar websocket options
Options
Flag Description Default
-c , --conf

Configuration file for WebSocket service

zookeeper

Starts up a ZooKeeper cluster

Usage
$ pulsar zookeeper options
Options
Flag Description Default
-c , --conf

Configuration file for ZooKeeper

zookeeper-shell

Connects to a running ZooKeeper cluster using the ZooKeeper shell

Usage
$ pulsar zookeeper-shell options
Options
Flag Description Default
-c , --conf

Configuration file for ZooKeeper

zookeeper-shell

Opens up a shell client to the ZooKeeper cluster used by Pulsar

Usage
$ pulsar zookeeper-shell

pulsar-admin

The pulsar-admin tool enables you to manage Pulsar installations, including clusters, brokers, namespaces, properties, and more.

Usage
$ pulsar-admin command
Commands

broker-stats

Operations to collect broker statistics

Usage
$ pulsar-admin broker-stats subcommand
Subcommands

allocator-stats

Dump allocator stats

Usage
$ pulsar-admin broker-stats allocator-stats allocator-name

destinations

Dump topic stats

Usage
$ pulsar-admin broker-stats destinations options
Options
Flag Description Default
-i , --indent

Indent JSON output

false

mbeans

Dump Mbean stats

Usage
$ pulsar-admin broker-stats mbeans options
Options
Flag Description Default
-i , --indent

Indent JSON output

false

monitoring-metrics

dump metrics for Monitoring

Usage
$ pulsar-admin broker-stats monitoring-metrics options
Options
Flag Description Default
-i , --indent

Indent JSON output

false

topics

Dump topic stats

Usage
$ pulsar-admin broker-stats topics options
Options
Flag Description Default
-i , --indent

Indent JSON output

false

brokers

Operations about brokers

Usage
$ pulsar-admin brokers subcommand
Subcommands

list

List active brokers of the cluster

Usage
$ pulsar-admin brokers list cluster-name

namespaces

List namespaces owned by the broker

Usage
$ pulsar-admin brokers namespaces cluster-name options
Options
Flag Description Default
--url

The URL for the broker

update-dynamic-config

Update a broker's dynamic service configuration

Usage
$ pulsar-admin brokers update-dynamic-config options
Options
Flag Description Default
--config

Service configuration parameter name

--value

Value for the configuration parameter value specified using the --config flag

list-dynamic-config

Get list of updatable configuration name

Usage
$ pulsar-admin brokers list-dynamic-config

get-all-dynamic-config

Get all overridden dynamic-configuration values

Usage
$ pulsar-admin brokers get-all-dynamic-config

get-internal-config

Get internal configuration information

Usage
$ pulsar-admin brokers get-internal-config

clusters

Operations about clusters

Usage
$ pulsar-admin clusters subcommand
Subcommands

get

Get the configuration data for the specified cluster

Usage
$ pulsar-admin clusters get cluster-name

create

Provisions a new cluster. This operation requires Pulsar super-user privileges.

Usage
$ pulsar-admin clusters create cluster-name options
Options
Flag Description Default
--broker-url

The URL for the broker service.

--broker-url-secure

The broker service URL for a secure connection

--url

service-url

--url-secure

service-url for secure connection

update

Update the configuration for a cluster

Usage
$ pulsar-admin clusters update cluster-name options
Options
Flag Description Default
--broker-url

The URL for the broker service.

--broker-url-secure

The broker service URL for a secure connection

--url

service-url

--url-secure

service-url for secure connection

delete

Deletes an existing cluster

Usage
$ pulsar-admin clusters delete cluster-name

list

List the existing clusters

Usage
$ pulsar-admin clusters list

update-peer-clusters

Update peer cluster names

Usage
$ pulsar-admin clusters update-peer-clusters peer-cluster-names

namespaces

Operations about namespaces

Usage
$ pulsar-admin namespaces subcommand
Subcommands

list

Get the namespaces for a property

Usage
$ pulsar-admin namespaces list property-name

list-cluster

Get the namespaces for a property in the cluster

Usage
$ pulsar-admin namespaces list-cluster property/cluster

destinations

Get the destinations for a namespace

Usage
$ pulsar-admin namespaces destinations property/cluster/namespace

policies

Get the policies of a namespace

Usage
$ pulsar-admin namespaces policies property/cluster/namespace

create

Create a new namespace

Usage
$ pulsar-admin namespaces create property/cluster/namespace options
Options
Flag Description Default
-b , --bundles

The number of bundles to activate

0

delete

Deletes a namespace

Usage
$ pulsar-admin namespaces delete property/cluster/namespace

permissions

Get the permissions on a namespace

Usage
$ pulsar-admin namespaces permissions property/cluster/namespace

grant-permission

Grant permissions on a namespace

Usage
$ pulsar-admin namespaces grant-permission property/cluster/namespace options
Options
Flag Description Default
--actions

Actions to be granted (produce or consume)

--role

The client role to which to grant the permissions

revoke-permission

Revoke permissions on a namespace

Usage
$ pulsar-admin namespaces revoke-permission property/cluster/namespace options
Options
Flag Description Default
--role

The client role from which to revoke the permissions

set-clusters

Set replication clusters for a namespace

Usage
$ pulsar-admin namespaces set-clusters property/cluster/namespace options
Options
Flag Description Default
-c , --clusters

Replication clusters ID list (comma-separated values)

get-clusters

Get replication clusters for a namespace

Usage
$ pulsar-admin namespaces get-clusters property/cluster/namespace

get-backlog-quotas

Get the backlog quota policies for a namespace

Usage
$ pulsar-admin namespaces get-backlog-quotas property/cluster/namespace

set-backlog-quota

Set a backlog quota for a namespace

Usage
$ pulsar-admin namespaces set-backlog-quota property/cluster/namespace options
Options
Flag Description Default
-l , --limit

The backlog size limit (for example 10M or 16G)

-p , --policy

The retention policy to enforce when the limit is reached. The valid options are:

  • producer_request_hold
  • producer_exception
  • consumer_backlog_eviction
Example
$ pulsar-admin namespaces set-backlog-quota my-prop/my-cluster/my-ns \
--limit 2G \
--policy producer_request_hold

remove-backlog-quota

Remove a backlog quota policy from a namespace

Usage
$ pulsar-admin namespaces remove-backlog-quota property/cluster/namespace

get-persistence

Get the persistence policies for a namespace

Usage
$ pulsar-admin namespaces get-persistence property/cluster/namespace

set-persistence

Set the persistence policies for a namespace

Usage
$ pulsar-admin namespaces set-persistence property/cluster/namespace options
Options
Flag Description Default
-a , --bookkeeper-ack-quorom

The number of acks (guaranteed copies) to wait for each entry

0
-e , --bookkeeper-ensemble

The number of bookies to use for a topic

0
-w , --bookkeeper-write-quorum

How many writes to make of each entry

0
-r , --ml-mark-delete-max-rate

Throttling rate of mark-delete operation (0 means no throttle)

get-message-ttl

Get the message TTL for a namespace

Usage
$ pulsar-admin namespaces get-message-ttl property/cluster/namespace

set-message-ttl

Set the message TTL for a namespace

Usage
$ pulsar-admin namespaces set-message-ttl options
Options
Flag Description Default
-ttl , --messageTTL

Message TTL in seconds

0

get-retention

Get the retention policy for a namespace

Usage
$ pulsar-admin namespaces get-retention property/cluster/namespace

set-retention

Set the retention policy for a namespace

Usage
$ pulsar-admin namespaces set-retention property/cluster/namespace options
Options
Flag Description Default
-s , --size

The retention size limits (for example 10M, 16G or 3T). 0 means no retention and -1 means infinite size retention

-t , --time

The retention time in minutes, hours, days, or weeks. Examples: 100m, 13h, 2d, 5w. 0 means no retention and -1 means infinite time retention

unload

Unload a namespace or namespace bundle from the current serving broker.

Usage
$ pulsar-admin namespaces unload property/cluster/namespace options
Options
Flag Description Default
-b , --bundle

clear-backlog

Clear the backlog for a namespace

Usage
$ pulsar-admin namespaces clear-backlog property/cluster/namespace options
Options
Flag Description Default
-b , --bundle
-f , --force

Whether to force a clear backlog without prompt

false
-s , --sub

The subscription name

unsubscribe

Unsubscribe the given subscription on all destinations on a namespace

Usage
$ pulsar-admin namespaces unsubscribe property/cluster/namespace options
Options
Flag Description Default
-b , --bundle
-s , --sub

The subscription name

ns-isolation-policy

Operations for managing namespace isolation policies.

Usage
$ pulsar-admin ns-isolation-policy subcommand
Subcommands

set

Create/update a namespace isolation policy for a cluster. This operation requires Pulsar superuser privileges.

Usage
$ pulsar-admin ns-isolation-policy set cluster-name policy-name options
Options
Flag Description Default
--auto-failover-policy-params

Comma-separated name=value auto failover policy parameters

[]
--auto-failover-policy-type

Auto failover policy type name. Currently available options: min_available.

[]
--namespaces

Comma-separated namespaces regex list

[]
--primary

Comma-separated primary broker regex list

[]
--secondary

Comma-separated secondary broker regex list

[]

get

Get the namespace isolation policy of a cluster. This operation requires Pulsar superuser privileges.

Usage
$ pulsar-admin ns-isolation-policy get cluster-name policy-name

list

List all namespace isolation policies of a cluster. This operation requires Pulsar superuser privileges.

Usage
$ pulsar-admin ns-isolation-policy list cluster-name

delete

Delete namespace isolation policy of a cluster. This operation requires superuser privileges.

Usage
$ pulsar-admin ns-isolation-policy delete

persistent

Operations on persistent topics

Usage
$ pulsar-admin persistent subcommand
Subcommands

list

Get the list of topics under a namespace

Usage
$ pulsar-admin persistent list property/cluster/namespace

permissions

Get the permissions on a topic. Retrieve the effective permissions for a desination. These permissions are defined by the permissions set at the namespace level combined (union) with any eventual specific permissions set on the topic.

Usage
$ pulsar-admin persistent permissions persistent://property/cluster/namespace/topic

grant-permission

Grant a new permission to a client role on a single topic

Usage
$ pulsar-admin persistent grant-permission persistent://property/cluster/namespace/topic options
Options
Flag Description Default
--actions

Actions to be granted (produce or consume)

--role

The client role to which permissions are to be granted

revoke-permission

Revoke permissions to a client role on a single topic. If the permission was not set at the topic level, but rather at the namespace level, this operation will return an error (HTTP status code 412).

Usage
$ pulsar-admin persistent revoke-permission persistent://property/cluster/namespace/topic

lookup

Look up a topic from the current serving broker

Usage
$ pulsar-admin persistent lookup persistent://property/cluster/namespace/topic

bundle-range

Get the namespace bundle which contains the given topic

Usage
$ pulsar-admin persistent bundle-range persistent://property/cluster/namespace/topic

delete

Delete a topic. The topic cannot be deleted if there are any active subscriptions or producers connected to the topic.

Usage
$ pulsar-admin persistent delete persistent://property/cluster/namespace/topic

unload

Unload a topic

Usage
$ pulsar-admin persistent unload persistent://property/cluster/namespace/topic

subscriptions

Get the list of subscriptions on the topic

Usage
$ pulsar-admin persistent subscriptions persistent://property/cluster/namespace/topic

unsubscribe

Delete a durable subscriber from a topic

Usage
$ pulsar-admin persistent unsubscribe persistent://property/cluster/namespace/topic options
Options
Flag Description Default
-s , --subscription

The subscription to delete

stats

Get the stats for the topic and its connected producers and consumers. All rates are computed over a 1-minute window and are relative to the last completed 1-minute period.

Usage
$ pulsar-admin persistent stats persistent://property/cluster/namespace/topic

stats-internal

Get the internal stats for the topic

Usage
$ pulsar-admin persistent stats-internal persistent://property/cluster/namespace/topic

info-internal

Get the internal metadata info for the topic

Usage
$ pulsar-admin persistent info-internal persistent://property/cluster/namespace/topic

partitioned-stats

Get the stats for the partitioned topic and its connected producers and consumers. All rates are computed over a 1-minute window and are relative to the last completed 1-minute period.

Usage
$ pulsar-admin persistent partitioned-stats persistent://property/cluster/namespace/topic options
Options
Flag Description Default
--per-partition

Get per-partition stats

false

skip

SKip some messages for the subscription

Usage
$ pulsar-admin persistent skip persistent://property/cluster/namespace/topic options
Options
Flag Description Default
-n , --count

The number of messages to skip

0
-s , --subscription

The subscription on which to skip messages

skip-all

Skip all the messages for the subscription

Usage
$ pulsar-admin persistent skip-all persistent://property/cluster/namespace/topic options
Options
Flag Description Default
-s , --subscription

The subscription to clear

expire-messages

Expire messages that are older than the given expiry time (in seconds) for the subscription.

Usage
$ pulsar-admin persistent expire-messages persistent://property/cluster/namespace/topic options
Options
Flag Description Default
-t , --expireTime

Expire messages older than the time (in seconds)

0
-s , --subscription

The subscription to skip messages on

expire-messages-all-subscriptions

Expire messages older than the given expiry time (in seconds) for all subscriptions

Usage
$ pulsar-admin persistent expire-messages-all-subscriptions persistent://property/cluster/namespace/topic options
Options
Flag Description Default
-t , --expireTime

Expire messages older than the time (in seconds)

0

create-partitioned-topic

Create a partitioned topic

Usage
$ pulsar-admin persistent create-partitioned-topic persistent://property/cluster/namespace/topic options
Options
Flag Description Default
-p , --partitions

The number of partitions for the topic

0

get-partitioned-topic-metadata

Get the partitioned topic metadata. If the topic is not created or is a non-partitioned topic, this will return an empty topic with zero partitions.

Usage
$ pulsar-admin persistent get-partitioned-topic-metadata persistent://property/cluster/namespace/topic

delete-partitioned-topic

Delete a partitioned topic. This will also delete all the partitions of the topic if they exist.

Usage
$ pulsar-admin persistent delete-partitioned-topic persistent://property/cluster/namespace/topic

peek-messages

Peek some messages for the subscription.

Usage
$ pulsar-admin persistent peek-messages persistent://property/cluster/namespace/topic options
Options
Flag Description Default
-n , --count

The number of messages

1
-s , --subscription

Subscription to get messages from

reset-cursor

Reset position for subscription to closest to timestamp

Usage
$ pulsar-admin persistent reset-cursor persistent://property/cluster/namespace/topic options
Options
Flag Description Default
-s , --subscription

Subscription to reset position on

-t , --time

The time, in minutes, to reset back to (or minutes, hours, days, weeks, etc.). Examples: 100m, 3h, 2d, 5w.

non-persistent

Operations on persistent topics

Usage
$ pulsar-admin non-persistent subcommand
Subcommands

create-partitioned-topic

Create a partitioned topic. A partitioned non-persistent topic must be created before producers can publish to it.

Usage
$ pulsar-admin non-persistent create-partitioned-topic non-persistent://property/cluster/namespace/topic options
Options
Flag Description Default
-p , --partitions

The number of partitions for the topic

0

lookup

Look up a non-persistent topic on the current serving broker

Usage
$ pulsar-admin non-persistent lookup non-persistent://property/cluster/namespace/topic

stats

Get the stats for the topic and its connected producers and consumers. All rates are computed over a 1-minute window and are relative to the last completed 1-minute period.

Usage
$ pulsar-admin non-persistent stats non-persistent://property/cluster/namespace/topic

stats-internal

Get the internal stats for the topic

Usage
$ pulsar-admin non-persistent stats-internal non-persistent://property/cluster/namespace/topic

get-partitioned-topic-metadata

Get the partitioned topic metadata. If the topic is not created or is a non-partitioned topic, this will return an empty topic with zero partitions.

Usage
$ pulsar-admin non-persistent get-partitioned-topic-metadata non-persistent://property/cluster/namespace/topic

list

Get a list of non-persistent topics under a namespace

Usage
$ pulsar-admin non-persistent list property/cluster/namespace

list-in-bundle

Get a list of non-persistent topics present under a namespace bundle

Usage
$ pulsar-admin non-persistent list-in-bundle property/cluster/namespace options
Options
Flag Description Default
-b , --bundle

The bundle range

properties

Operations about properties

Usage
$ pulsar-admin properties subcommand
Subcommands

list

List the existing properties

Usage
$ pulsar-admin properties list

get

Gets the configuration of a property

Usage
$ pulsar-admin properties get property-name

create

Creates a new property

Usage
$ pulsar-admin properties create property-name options
Options
Flag Description Default
-r , --admin-roles

Comma-separated admin roles

-c , --allowed-clusters

Comma-separated allowed clusters

update

Updates a property

Usage
$ pulsar-admin properties update property-name options
Options
Flag Description Default
-r , --admin-roles

Comma-separated admin roles

-c , --allowed-clusters

Comma-separated allowed clusters

delete

Deletes an existing property

Usage
$ pulsar-admin properties delete property-name

resource-quotas

Operations about resource quotas

Usage
$ pulsar-admin resource-quotas subcommand
Subcommands

get

Get the resource quota for a specified namespace bundle, or default quota if no namespace/bundle is specified.

Usage
$ pulsar-admin resource-quotas get options
Options
Flag Description Default
-b , --bundle

A bundle of the form {start-boundary}_{end_boundary}. This must be specified together with -n/--namespace.

-n , --namespace

The namespace

set

Set the resource quota for the specified namespace bundle, or default quota if no namespace/bundle is specified.

Usage
$ pulsar-admin resource-quotas set options
Options
Flag Description Default
-bi , --bandwidthIn

The expected inbound bandwidth (in bytes/second)

0
-bo , --bandwidthOut

Expected outbound bandwidth (in bytes/second)

0
-b , --bundle

A bundle of the form {start-boundary}_{end_boundary}. This must be specified together with -n/--namespace.

-d , --dynamic

Allow to be dynamically re-calculated (or not)

false
-mem , --memory

Expectred memory usage (in megabytes)

0
-mi , --msgRateIn

Expected incoming messages per second

0
-mo , --msgRateOut

Expected outgoing messages per second

0
-n , --namespace

The namespace as property/cluster/namespace, for example my-prop/my-cluster/my-ns. Must be specified together with -b/--bundle.

reset-namespace-bundle-quota

Reset the specifed namespace bundle's resource quota to a default value.

Usage
$ pulsar-admin resource-quotas reset-namespace-bundle-quota options
Options
Flag Description Default
-b , --bundle

A bundle of the form {start-boundary}_{end_boundary}.

-n , --namespace

The namespace as property/cluster/namespace, for example my-prop/my-cluster/my-ns.

pulsar-client

The pulsar-client tool

Usage
$ pulsar-client command
Commands
Options
Flag Description Default
--auth-params

Authentication parameters, for example key1:val1,key2:val2

--auth-plugin

Authentication plugin class name

--url

Broker URL to which to connect

pulsar://localhost:6650/

produce

Send a message or messages to a specific broker and topic

Usage
$ pulsar-client produce topic options
Options
Flag Description Default
-f , --files

Comma-separated file paths to send; either -m or -f must be specified

[]
-m , --messages

Comma-separated string of messages to send; either -m or -f must be specified

[]
-n , --num-produce

The number of times to send the message(s); the count of messages/files * num-produce should be below 1000

1
-r , --rate

Rate (in messages per second) at which to produce; a value 0 means to produce messages as fast as possible

0.0

consume

Consume messages from a specific broker and topic

Usage
$ pulsar-client consume topic options
Options
Flag Description Default
--hex

Display binary messages in hexadecimal format.

false
-n , --num-messages

Number of messages to consume, 0 means to consume forever.

0
-r , --rate

Rate (in messages per second) at which to produce; a value 0 means to produce messages as fast as possible

0.0
-s , --subscription-name

Subscription name

-t , --subscription-type

The type of the subscription. Possible values: Exclusive, Shared, Failover.

exclusive

pulsar-daemon

A wrapper around the pulsar tool that’s used to start and stop processes, such as ZooKeeper, bookies, and Pulsar brokers, in the background using nohup.

pulsar-daemon has a similar interface to the pulsar command but adds start and stop commands for various services. For a listing of those services, run pulsar-daemon to see the help output or see the documentation for the pulsar command.

Usage
$ pulsar-daemon command
Commands

start

Start a service in the background using nohup.

Usage
$ pulsar-daemon start service

stop

Stop a service that’s already been started using start.

Usage
$ pulsar-daemon stop service options
Options
Flag Description Default
-force

Stop the service forcefully if not stopped by normal shutdown.

false

pulsar-perf

A tool for performance testing a Pulsar broker.

Usage
$ pulsar-perf command
Commands
Environment variables

The table below lists the environment variables that you can use to configure the pulsar-perf tool.

Variable Description Default
PULSAR_LOG_CONF Log4j configuration file conf/log4j2.yaml
PULSAR_CLIENT_CONF Configuration file for the client conf/client.conf
PULSAR_EXTRA_OPTS Extra options to be passed to the JVM
PULSAR_EXTRA_CLASSPATH Extra paths for Pulsar's classpath

consume

Run a consumer

Usage
$ pulsar-perf consume options
Options
Flag Description Default
--auth_params

Authentication parameters in the form of key1:val1,key2:val2

--auth_plugin

Authentication plugin class name

-b , --batch-time-window

Batch messages in a window of the specified number of milliseconds

1
-z , --compression

Compress messages’ payload. Possible values are NONE, LZ4, or ZLIB.

--conf-file

Configuration file

-c , --max-connections

Max number of TCP connections to a single broker

0
-o , --max-outstanding

Max number of outstanding messages

1000
-m , --num-messages

Number of messages to publish in total. If set to 0, it will keep publishing.

0
-n , --num-producers

The number of producers (per topic)

1
-t , --num-topic

The number of topics

1
-f , --payload-file

Use payload from a file instead of an empty buffer

-r , --rate

Publish rate msg/s across topics

100
-u , --service-url

Pulsar service URL

-s , --size

Message size (in bytes)

1024
-i , --stats-interval-seconds

Statistics interval seconds. If 0, statistics will be disabled.

0
-time , --test-duration

Test duration in secs. If set to 0, it will keep publishing.

0

produce

Run a producer

Usage
$ pulsar-perf produce options
Options
Flag Description Default
--auth_params

Authentication parameters in the form of key1:val1,key2:val2

--auth_plugin

Authentication plugin class name

-b , --batch-time-window

Batch messages in a window of the specified number of milliseconds

1
-z , --compression

Compress messages’ payload. Possible values are NONE, LZ4, or ZLIB.

["--conf-file"]

Configuration file

-c , --max-connections

Max number of TCP connections to a single broker

0
-o , --max-outstanding

Max number of outstanding messages

1000
-m , --num-messages

Number of messages to publish in total. If set to 0, it will keep publishing.

0
-n , --num-producers

The number of producers (per topic)

1
-t , --num-topic

The number of topics

1
-f , --payload-file

Use payload from a file instead of an empty buffer

-r , --rate

Publish rate msg/s across topics

100
-u , --service-url

Pulsar service URL

-s , --size

Message size (in bytes)

1024
-i , --stats-interval-seconds

Statistics interval seconds. If 0, statistics will be disabled.

0
-time , --test-duration

Test duration in secs. If set to 0, it will keep publishing.

0

monitor-brokers

Continuously receive broker data and/or load reports

Usage
$ pulsar-perf monitor-brokers options
Options
Flag Description Default
--connect-string

A connection string for one or more ZooKeeper servers

simulation-client

Run a simulation server acting as a Pulsar client. Uses the client configuration specified in conf/client.conf.

Usage
$ pulsar-perf simulation-client

simulation-controller

Run a simulation controller to give commands to servers

Usage
$ pulsar-perf simulation-controller options
Options
Flag Description Default
--client-port

The port that the clients are listening on

0
--clients

Comma-separated list of client hostnames

--cluster

The cluster to test on

bookkeeper

A tool for managing BookKeeper.

Usage
$ bookkeeper command
Commands
Environment variables

The table below lists the environment variables that you can use to configure the bookkeeper tool.

Variable Description Default
BOOKIE_LOG_CONF Log4j configuration file conf/log4j2.yaml
BOOKIE_CONF BookKeeper configuration file conf/bk_server.conf
BOOKIE_EXTRA_OPTS Extra options to be passed to the JVM
BOOKIE_EXTRA_CLASSPATH Extra paths for BookKeeper's classpath
ENTRY_FORMATTER_CLASS The Java class used to format entries
BOOKIE_PID_DIR Folder where the BookKeeper server PID file should be stored
BOOKIE_STOP_TIMEOUT Wait time before forcefully killing the Bookie server instance if attempts to stop it are not successful

auto-recovery

Runs an auto-recovery service daemon

Usage
$ bookkeeper auto-recovery options
Options
Flag Description Default
-c , --conf

Configuration for the auto-recovery daemon

bookie

Starts up a BookKeeper server (aka bookie)

Usage
$ bookkeeper bookie options
Options
Flag Description Default
-c , --conf

Configuration for the bookie server

-readOnly

Force start a read-only bookie server

false
-withAutoRecovery

Start auto-recovery service bookie server

false

localbookie

Runs a test ensemble of N bookies locally

Usage
$ bookkeeper localbookie N

upgrade

Upgrade the bookie’s filesystem

Usage
$ bookkeeper upgrade options
Options
Flag Description Default
-c , --conf

Configuration for the bookie server

-c , --conf

Finalize the upgrade

-c , --conf

Roll the upgrade back

-u , --upgrade

Upgrade the bookie’s directories

shell

Run shell for admin commands. To see a full listing of those commands, run bookkeeper shell without an argument.

Usage
$ bookkeeper shell
Example
$ $ bookkeeper shell bookiesanity