Managing Brokers

Pulsar brokers consist of two components:

See the Configuration page for a full listing of broker-specific configuration parameters.

Brokers resources

List active brokers

Fetch all available active brokers that are serving traffic.

pulsar-admin

  1. $ pulsar-admin brokers list use
  1. broker1.use.org.com:8080
REST

GET/admin/v2/brokers/:cluster

Java
  1. admin.brokers().getActiveBrokers(clusterName)

list of namespaces owned by a given broker

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

CLI
  1. $ pulsar-admin brokers namespaces use \
  2. --url broker1.use.org.com:8080
  1. {
  2. "my-property/use/my-ns/0x00000000_0xffffffff": {
  3. "broker_assignment": "shared",
  4. "is_controlled": false,
  5. "is_active": true
  6. }
  7. }
REST

GET/admin/v2/brokers/:cluster/:broker/ownedNamespaces

Java
  1. admin.brokers().getOwnedNamespaces(cluster,brokerUrl);

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

pulsar-admin

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

  1. $ pulsar-admin brokers update-dynamic-config brokerShutdownTimeoutMs 100

REST API

POST/admin/v2/brokers/configuration/:configName/:configValue

Java

  1. admin.brokers().updateDynamicConfiguration(configName, configValue);

List updated values

Fetch a list of all potentially updatable configuration parameters.

pulsar-admin

  1. $ pulsar-admin brokers list-dynamic-config
  2. brokerShutdownTimeoutMs

REST API

GET/admin/v2/brokers/configuration

Java

  1. admin.brokers().getDynamicConfigurationNames();

List all

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

pulsar-admin

  1. $ pulsar-admin brokers get-all-dynamic-config
  2. brokerShutdownTimeoutMs:100

REST API

GET/admin/v2/brokers/configuration/values

Java

  1. admin.brokers().getAllDynamicConfigurations();