pulsar command is the main entry point for running Apache Pulsar server components and utilities.
Usage
Available Commands
Server Components
broker
Run a Pulsar broker server.conf/broker.conf
Environment Variables:
PULSAR_BROKER_CONF- Path to broker configuration filePULSAR_LOG_CONF- Path to log4j2 configurationPULSAR_EXTRA_OPTS- Additional JVM optionsPULSAR_MEM- JVM memory settings
bookie
Run a BookKeeper bookie server.conf/bookkeeper.conf
Environment Variables:
PULSAR_BOOKKEEPER_CONF- Path to bookie configuration fileBOOKIE_EXTRA_OPTS- Additional JVM options for bookieBOOKIE_MEM- JVM memory settings for bookie
zookeeper
Run a ZooKeeper server.conf/zookeeper.conf
Environment Variables:
PULSAR_ZK_CONF- Path to ZooKeeper configuration file
configuration-store
Run a configuration store (global ZooKeeper) server.conf/global_zookeeper.conf
Environment Variables:
PULSAR_CONFIGURATION_STORE_CONF- Path to configuration store file
proxy
Run a Pulsar proxy server.conf/proxy.conf
Environment Variables:
PULSAR_PROXY_CONF- Path to proxy configuration file
websocket
Run a WebSocket proxy server.conf/websocket.conf
Environment Variables:
PULSAR_WEBSOCKET_CONF- Path to websocket configuration file
functions-worker
Run a Pulsar Functions worker server.conf/functions_worker.yml
Environment Variables:
PULSAR_WORKER_CONF- Path to functions worker configuration
standalone
Run Pulsar in standalone mode (all components in one JVM).conf/standalone.conf
Options:
--config- Configuration file path--no-broker- Only start ZooKeeper and BookKeeper--only-broker- Only start Pulsar broker (requires ZooKeeper and BookKeeper)--no-functions-worker- Don’t start functions worker--stream-storage-port- Port for stream storage
autorecovery
Run BookKeeper auto-recovery service.conf/bookkeeper.conf
Cluster Utilities
initialize-cluster-metadata
One-time initialization of cluster metadata.--cluster- Cluster name--zookeeper- Local ZooKeeper connection string--configuration-store- Configuration store connection string--web-service-url- Web service URL for the cluster--broker-service-url- Broker service URL for the cluster
--web-service-url-tls- HTTPS URL for web service--broker-service-url-tls- TLS URL for broker service--existing-bk-metadata-service-uri- Existing BookKeeper metadata service URI
delete-cluster-metadata
Delete cluster metadata.--cluster- Cluster name to delete--zookeeper- Local ZooKeeper connection string--configuration-store- Configuration store connection string
initialize-transaction-coordinator-metadata
One-time initialization of transaction coordinator metadata.--cluster- Cluster name--configuration-store- Configuration store connection string
--initial-num-transaction-coordinators- Number of transaction coordinators (default: 16)
initialize-namespace
Initialize namespace metadata.Topic Utilities
compact-topic
Run compaction on a topic.--topic- Topic name to compact--broker-conf- Path to broker configuration file
Development Tools
zookeeper-shell
Open a ZooKeeper shell client.broker-tool
CLI tool for broker operations.load-report- Get load report from a brokerlist-unload-bundles- List bundles to be unloaded
tokens
Utility to create authentication tokens.create- Create a new tokencreate-secret-key- Create a new secret keycreate-key-pair- Create a public/private key pairshow- Show token claimsvalidate- Validate a token
version
Display Pulsar version information.Environment Variables
Common environment variables for all Pulsar commands:| Variable | Description |
|---|---|
PULSAR_LOG_CONF | Log4j2 configuration file (default: conf/log4j2.yaml) |
PULSAR_EXTRA_OPTS | Extra JVM options |
PULSAR_EXTRA_CLASSPATH | Additional classpath entries |
PULSAR_PID_DIR | Directory for PID files |
PULSAR_STOP_TIMEOUT | Stop timeout in seconds |
PULSAR_LOG_LEVEL | Log level (default: info) |
PULSAR_LOG_ROOT_LEVEL | Root log level |
PULSAR_LOG_DIR | Log directory (default: logs/) |
PULSAR_MEM | JVM memory settings |
PULSAR_GC | JVM GC settings |
PULSAR_GC_LOG | GC log settings |
JAVA_HOME | Java installation directory |
Configuration Files
Default configuration file locations (relative toPULSAR_HOME):
| Component | Configuration File |
|---|---|
| Broker | conf/broker.conf |
| Bookie | conf/bookkeeper.conf |
| ZooKeeper | conf/zookeeper.conf |
| Configuration Store | conf/global_zookeeper.conf |
| Proxy | conf/proxy.conf |
| WebSocket | conf/websocket.conf |
| Functions Worker | conf/functions_worker.yml |
| Standalone | conf/standalone.conf |
Examples
Running Standalone for Development
Setting Up a Production Cluster
Enabling Transaction Support
Creating Authentication Tokens
Custom JVM Settings
Using Custom Configuration
System Requirements
- Java: Java 17 or later (required)
- Memory: Minimum 4GB RAM for standalone, 8GB+ for production
- Disk: Fast SSD recommended for BookKeeper
- Network: Low-latency network for multi-node clusters
Running as a Service
systemd Service Example
Create/etc/systemd/system/pulsar-broker.service:
Logging
Logs are written toPULSAR_LOG_DIR (default: logs/):
pulsar-broker.log- Broker logsbookkeeper.log- Bookie logszookeeper.log- ZooKeeper logspulsar-proxy.log- Proxy logspulsar-standalone.log- Standalone logs
conf/log4j2.yaml.
Troubleshooting
Check Component Status
View Logs
Test ZooKeeper Connection
Related Commands
- pulsar-admin - Administer Pulsar clusters
- pulsar-client - Produce and consume messages