Skip to main content

Managing Brokers

tip

This page only shows some frequently used operations.

  • For the latest and complete information about Pulsar admin, including commands, flags, descriptions, and more information, see Pulsar admin doc.

  • For the latest and complete information about REST API, including parameters, responses, samples, and more, see REST API doc.

  • For the latest and complete information about Java admin API, including classes, methods, descriptions, and more, see Java admin API doc.

Pulsar brokers consist of two components:

  1. An HTTP server exposing a REST interface administration and topic lookup.
  2. A dispatcher that handles all Pulsar message transfers.

Brokers can be managed via:

  • The brokers command of the pulsar-admin tool
  • The /admin/v2/brokers endpoint of the admin REST API
  • The brokers method of the PulsarAdmin object in the Java API

In addition to being configurable when you start them up, brokers can also be dynamically configured.

For a full listing of broker-specific configuration parameters, see the Configuration page.

Brokers resources

List active brokers

Fetch all available active brokers that are serving traffic with cluster name.

pulsar-admin brokers list use

Example output:

localhost:8080

Get the information of the leader broker

Fetch the information of the leader broker, for example, the service url.

pulsar-admin brokers leader-broker

Example output:

{
"serviceUrl" : "http://localhost:8080"
}

list of namespaces owned by a given broker

It finds all namespaces which are owned and served by a given broker.

pulsar-admin brokers namespaces use \
--url localhost:8080

Example output:

public/default/0x00000000_0x40000000    [broker_assignment=shared is_controlled=false is_active=true]
public/default/0xc0000000_0xffffffff [broker_assignment=shared is_controlled=false is_active=true]
public/functions/0x40000000_0x80000000 [broker_assignment=shared is_controlled=false is_active=true]
public/functions/0x00000000_0x40000000 [broker_assignment=shared is_controlled=false is_active=true]
pulsar/standalone/localhost:8080/0x00000000_0xffffffff [broker_assignment=shared is_controlled=false is_active=true]
pulsar/localhost:8080/0x00000000_0xffffffff [broker_assignment=shared is_controlled=false is_active=true]
public/functions/0x80000000_0xc0000000 [broker_assignment=shared is_controlled=false is_active=true]
public/default/0x80000000_0xc0000000 [broker_assignment=shared is_controlled=false is_active=true]

Dynamic broker configuration

One way to configure a Pulsar broker is to supply a configuration when the broker is started up.

But since all broker configuration in Pulsar is stored in ZooKeeper, configuration values can also be dynamically updated while the broker is running. When you update broker configuration dynamically, ZooKeeper will notify the broker of the change and the broker will then override any existing configuration values.

  • The brokers command for the pulsar-admin tool has a variety of subcommands that enable you to manipulate a broker's configuration dynamically, enabling you to update config values and more.
  • In the Pulsar admin REST API, dynamic configuration is managed through the /admin/v2/brokers/configuration endpoint.

Update dynamic configuration

The update-dynamic-config subcommand will update existing configuration. It takes two arguments: the name of the parameter and the new value using the config and value flag respectively. Here's an example of the brokerShutdownTimeoutMs parameter:

pulsar-admin brokers update-dynamic-config --config brokerShutdownTimeoutMs --value 100

List updated values

Fetch a list of all potentially updatable configuration parameters.

pulsar-admin brokers list-dynamic-config

Example output:

forceDeleteNamespaceAllowed
loadBalancerMemoryResourceWeight
allowAutoTopicCreation
brokerDeleteInactivePartitionedTopicMetadataEnabled
managedLedgerInactiveLedgerRolloverTimeSeconds
loadBalancerNamespaceBundleMaxMsgRate
resourceUsageTransportPublishIntervalInSecs
# omit...

List all

Fetch a list of all parameters that have been dynamically updated.

pulsar-admin brokers get-all-dynamic-config

Example output:

brokerShutdownTimeoutMs    100