The Pulsar proxy
The Pulsar proxy is an optional gateway that you can run over the brokers in a Pulsar cluster. We recommend running a Pulsar proxy in cases when direction connections between clients and Pulsar brokers are either infeasible, undesirable, or both, for example when running Pulsar in a cloud environment or on Kubernetes or an analogous platform.
Running the proxy
In order to run the Pulsar proxy, you need to have both a local and global ZooKeeper quorum set up for use by your Pulsar cluster. For instructions, see this document. Once you have ZooKeeper set up and have connection strings for both ZooKeeper quorums, you can use the
proxy command of the
pulsar CLI tool to start up the proxy (preferably on its own machine or in its own VM):
To start the proxy:
$ cd /path/to/pulsar/directory $ bin/pulsar proxy \ --zookeeper-servers zk-0,zk-1,zk-2 \ --global-zookeeper-servers zk-0,zk-1,zk-2
You can run as many instances of the Pulsar proxy in a cluster as you would like.
Stopping the proxy
The Pulsar proxy runs by default in the foreground. To stop the proxy, simply stop the process in which it’s running.
We recommend running the Pulsar proxy behind some kind of load-distributing frontend, such as an HAProxy load balancer.
Using Pulsar clients with the proxy
Once your Pulsar proxy is up and running, preferably behind a load-distributing frontend, clients can connect to the proxy via whichever address is used by the frontend. If the address were the DNS address
pulsar.cluster.default, for example, then the connection URL for clients would be