Skip to content

Instantly share code, notes, and snippets.

@merlimat
Created March 10, 2018 02:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merlimat/bfdd3c66bfa7387fe6e3bfa3bb263051 to your computer and use it in GitHub Desktop.
Save merlimat/bfdd3c66bfa7387fe6e3bfa3bb263051 to your computer and use it in GitHub Desktop.

Multi-region Pulsar setup with standalone

Let's assume we have 3 regions: [a, b, c]

We want to start Pulsar standalone in each region and setup geo-replication between them, without involving the deployment of a global-zookeeper instance.

Configure standalone

In each machine, configure the standalone to use a specific cluster name:

in conf/standalone.conf edit:

clusterName=a

with the right cluster name for each region

Start the standalone:

bin/pulsar standalone

Configure the clusters

Each standalone needs to know where are the other located.

For example, for cluster a we need to let him know where b and c are.

bin/pulsar-admin clusters create b --url pulsar://${IP_B}:6650
bin/pulsar-admin clusters create c --url pulsar://${IP_C}:6650

In region b, similarly:

bin/pulsar-admin clusters create a --url pulsar://${IP_A}:6650
bin/pulsar-admin clusters create c --url pulsar://${IP_C}:6650

and so on.

Configure the namespace

We need now to create a namespace and configure so that data will be replicated across the 3 regions.

Since we don't have global-zookeeper, we need to run the following commands on each region:

# Create a tenant that is allowed to use these 3 clusters
bin/pulsar-admin properties create my-tenant \
            --admin-roles test --allowed-clusters a,b,c

# Create namespace
bin/pulsar-admin namespaces create my-tenant/global/my-namespace

# Configure replication
bin/pulsar-admin namespaces set-clusters \
                my-tenant/global/my-namespace --clusters a,b,c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment