Work with tenants
You can create, update, and delete tenants using the pulsarctl CLI tool. For a full list of supported operations on tenants, see pulsarctl command reference. Before using the pulsarctl CLI tool, you need to connect to a Pulsar cluster. For details, see connect to Pulsar cluster on StreamNative Cloud and connect to Pulsar cluster on StreamNative Platform.Create a tenant
After creating a Pulsar cluster, you can create tenants for the Pulsar cluster. When creating a tenant, you need to use-cluster
or -c
option to specify the target cluster for the tenant.
This example shows how to create a tenant named example-tenant
for the example-cluster
cluster with the admin role. If you do not configure the admin role when creating the tenant, you cannot perform follow-up operations on the target tenant, such as updating or deleting tenants.
Input
Manage a tenant
This section describes how to manage tenants through the pulsarctl CLI tool.Update a tenant
When you want to add more admin roles for a tenant, you can use thepulsarctl tenants update
command to update the target tenant.
This example shows how to update the admin role for example-tenant
.
Input
Delete a tenant
When you want to remove a tenant from a Pulsar cluster, you can delete it. If a tenant is associated with any resources, you cannot delete the tenant. In this case, you must delete its associated resources first.You cannot delete a tenant if there are resources associated with the tenant.
example-tenant
.
Input
Work with namespaces
You can create and manage namespaces using the pulsarctl CLI tool. For a full list of supported operations on namespaces, see the pulsarctl command reference.This section uses a tenant named
example-tenant
as an example. For details about how to create a tenant, see work with tenants.Create a namespace
After creating and authorizing a tenant, you can create and manage namespaces and topics. This example shows how to create a namespace namedexample-ns
for example-tenant
.
Input
Manage a namespace
This section describes how to manage namespaces using the pulsarctl CLI tool.Clear namespace backlog
Pulsar stores all unacknowledged messages in backlogs until they are processed and acknowledged. You can clear backlogs of messages for a specific namespace to release more backlog quota for the namespace. This example shows how to clear the backlog for all topics ofexample-tenant/example-ns
.
Input
Unload a namespace
This example shows how to unloadexample-tenant/example-ns
from the current serving broker.
Input
Delete a namespace
You cannot delete a namespace if there are resources associated with the namespace.
example-tenant/example-ns
.
Input
Work with topics
This section describes how to create and manage topics using the pulsarctl CLI tool. For a full list of supported operations on topics, see pulsarctl command reference. Before using the pulsarctl CLI tool to create and manage topics, you need to create a tenant and a namespace.Create a topic
You can use thepulsarctl topics create TOPIC_NAME
command to create a topic.
-
If you want to create a non-partitioned topic, you need to set the number of partitions to
0
. This example shows how to create a non-partitioned topic in theexample-tenant/example-ns
namespace. InputOutput -
If you want to create a partitioned topic, you need to set the number of partitions to a specific number.
This example shows how to create a topic with 5 partitions in the
example-tenant/example-ns
namespace. InputOutput
Manage a topic
This section describes how to manage topics using the pulsarctl CLI tool.Get topic status
You can use thepulsarctl topics get TOPIC_NAME
command to get information about a specific topic.
-
This example shows how to list all topics available for the
example-tenant/example-ns
namespace. InputOutput -
This example shows how to get detailed information about the
topic-test
topic. InputOutput
Delete a topic
You can use thepulsarctl topics delete TOPIC_NAME
command to delete a partitioned topic. To delete a non-partitioned topic, you need to set the --non-partitioned
parameter.
-
This example shows how to delete the
test-topic
partitioned topic. InputOutput -
This example shows how to delete the
topic-test
non-partitioned topic. InputOutput
Related topics
- Learn about all the available Pulsar CLI Tools on StreamNative Cloud.
- Learn about all the available Pulsar CLI Tools on StreamNative Platform.