This page shows how to configure access to multiple Pulsar clusters by using configuration files. After your clusters, authentication information, and contexts are defined in one or more configuration files, you can quickly switch between clusters by using theDocumentation Index
Fetch the complete documentation index at: https://docs.streamnative.io/llms.txt
Use this file to discover all available pages before exploring further.
pulsarctl context use command.
A file that is used to configure access to a cluster is sometimes called a pulsarconfig file. This is a generic way of referring to configuration files. It does not mean that there is a file named
pulsarconfig.Before you begin
You need to have a Pulsar cluster, and thepulsarctl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one fully-managed Pulsar cluster on StreamNative Cloud, spin a self-managed StreamNative Private Cloud cluster, or run a standalone Pulsar cluster locally.
To check that pulsarctl is installed, run pulsarctl --version.
Define contexts and authentication info
Suppose you have two clusters, one for development work and one for production work. Thedevelopment cluster is self-managed in your own datacenter, using Token authentication, while the production cluster is fully-managed on StreamNative Cloud, using OAuth2 authentication.
Now, you can use pulsarctl context set to define your clusters and the corresponding authentication information.
First, you can create a development context to access your development cluster running at https://1.2.3.4 using token stored in file /path/to/token.
production context to access your production cluster running at https://5.6.7.8 on StreamNative Cloud using the OAuth2 private key file /path/to/credentials.json.
Instead of manually configuring a context to access a StreamNative Cloud cluster, you can also use
snctl x update-pulsar-config to add the cluster to the pulsarconfig file.Please note that x in snctl x is a sub command for a group of experimental commands.pulsarctl context get to retrieve the list of available contexts configured for pulsarctl. You should be able to see similar output as below.
${HOME}/.config/pulsar/config. Run the following command to check the context of pulsarconfig file.
Set the current context
When you define the context in${HOME}/.config/pulsar/config, you can quickly switch between clusters by using the following command (suppose you want to use the development cluster):
development cluster. And you can validate the current context by using pulsarctl context current command.
If you don’t know the current available list of contexts, you can use the following command: