pulsarctl is a CLI tool that you can use to manage Pulsar clusters. This document provides examples of how to use the pulsarctl CLI tool to connect to a Pulsar cluster through a token or an OAuth2 credential file.
Connect to a Pulsar cluster using a token
This example shows how to use thepulsarctl CLI tool to connect to your Pulsar cluster using a token and then list tenants available for this cluster.
admin-service-url and token parameters based on the descriptions in the prepare to connect to a Pulsar cluster user guide.
Connect to a Pulsar cluster using an OAuth2 credential file
If it is the first time you install and use the
pulsarctl CLI tool, you must use the pulsarctl context set command to set a context (cluster) in advance.- Generate the App credentials by following similar instructions in the configure OAuth2 authentication user guide.
- Save the App credentials into an OAuth2 credential file.
-
Create a context.
The
pulsarctlCLI tool uses a configuration file for cluster-specific settings. Each cluster is associated with a context. This example creates a context calledneo-1based on the App registration details.admin-service-url: the service URL of your Pulsar cluster.issuer-endpoint: the URL of your OAuth2 identity provider.audience: the audience of your Pulsar cluster.key-file: the absolute path to your OAuth2 credential file.
-
Log in to your Pulsar cluster.
-
Get Pulsar resources.
This example lists tenants for the cluster
neo-1. InputOutPut