Important
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 {@inject: rest: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:
Brokers can be managed via:
brokers
command of the pulsar-admin
tool/admin/v2/brokers
endpoint of the admin {@inject: rest:REST:/} APIbrokers
method of the PulsarAdmin
object in the Java APIIn addition to being configurable when you start them up, brokers can also be dynamically configured.
See the Configuration page for a full listing of broker-specific configuration parameters.
Fetch all available active brokers that are serving traffic.
$ pulsar-admin brokers list use
broker1.use.org.com:8080
{@inject: endpoint|GET|/admin/v2/brokers/:cluster|operation/getActiveBrokers?version=[[pulsar:version_number]]}
admin.brokers().getActiveBrokers(clusterName)
Fetch the information of the leader broker, for example, the service url.
$ pulsar-admin brokers leader-broker
BrokerInfo(serviceUrl=broker1.use.org.com:8080)
{@inject: endpoint|GET|/admin/v2/brokers/leaderBroker?version=[[pulsar:version_number]]}
admin.brokers().getLeaderBroker()
For the detail of the code above, see here
It finds all namespaces which are owned and served by a given broker.
$ pulsar-admin brokers namespaces use \ --url broker1.use.org.com:8080
{ "my-property/use/my-ns/0x00000000_0xffffffff": { "broker_assignment": "shared", "is_controlled": false, "is_active": true } }
{@inject: endpoint|GET|/admin/v2/brokers/:cluster/:broker/ownedNamespaces|operation/getOwnedNamespaes?version=[[pulsar:version_number]]}
admin.brokers().getOwnedNamespaces(cluster,brokerUrl);
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.
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./admin/v2/brokers/configuration
endpoint.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 for the brokerShutdownTimeoutMs
parameter:
$ pulsar-admin brokers update-dynamic-config --config brokerShutdownTimeoutMs --value 100
{@inject: endpoint|POST|/admin/v2/brokers/configuration/:configName/:configValue|operation/updateDynamicConfiguration?version=[[pulsar:version_number]]}
admin.brokers().updateDynamicConfiguration(configName, configValue);
Fetch a list of all potentially updatable configuration parameters.
$ pulsar-admin brokers list-dynamic-config brokerShutdownTimeoutMs
{@inject: endpoint|GET|/admin/v2/brokers/configuration|operation/getDynamicConfigurationName?version=[[pulsar:version_number]]}
admin.brokers().getDynamicConfigurationNames();
Fetch a list of all parameters that have been dynamically updated.
$ pulsar-admin brokers get-all-dynamic-config brokerShutdownTimeoutMs:100
{@inject: endpoint|GET|/admin/v2/brokers/configuration/values|operation/getAllDynamicConfigurations?version=[[pulsar:version_number]]}
admin.brokers().getAllDynamicConfigurations();