1. StreamNative Platform
  2. Administer

Work with namespaces

A namespace is a logical grouping of topics. After creating a tenant, you can create one or more namespaces for the tenant.

Work with namespaces using the pulsarctl CLI tool

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 named example-ns for example-tenant.

Input

pulsarctl namespaces create example-tenant/example-ns

Output

Created example-tenant/example-ns successfully

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 of example-tenant/example-ns.

Input

pulsarctl namespaces clear-backlog example-tenant/example-ns

Output

Are you sure you want to clear the backlog? (Y or N)

y

Successfully clear backlog for all topics of the example-tenant/example-ns

Unload a namespace

This example shows how to unload example-tenant/example-ns from the current serving broker.

Input

pulsarctl namespaces unload example-tenant/example-ns

Output

Unload namespace example-tenant/example-ns successfully

Delete a namespace

You cannot delete a namespace if there are resources associated with the namespace.

This example shows how to delete example-tenant/example-ns.

Input

pulsarctl namespaces delete example-tenant/example-ns

Output

Deleted example-tenant/example-ns successfully

Work with namespaces using StreamNative Console

This section describes how to create and manage namespaces using the StreamNative Console.

Create a namespace

To create a namespace, follow these steps.

  1. On the left navigation pane, under ADMIN, click Tenants/Namespaces.

  2. Select the name of the tenant you want to associate with the new namespace, and click New Namespace. A dialog box displays.

  3. Enter a name for the namespace and then click Confirm. A namespace name can contain any combination of lowercase letters (a-z), numbers (0-9), and hyphens (-).

Manage a namespace

This section describes how to work with namespaces through the StreamNative Console.

Unload bundles for a namespace

For assignment, a namespace is sharded into a list of bundles, with each bundle comprising a portion of the overall hash range of the namespace. By default, four bundles are supported for each namespace.

To unload bundles for a namespace, follow these steps.

  1. On the left navigation pane, under ADMIN, click Tenants/Namespaces.

  2. Select the name of the tenant that is associated with the target namespace.

  3. Click the name of the namespace that you want to manage.

  4. Select the OVERVIEW tab.

  5. In the Bundle section, do one of the followings:

    • Click Unload All to unload all bundles for the namespaces in the cluster.

    • Click Unload All in the Operation column to unload a specific bundle for the namespace.

Clear namespace backlog

To clear backlog for bundles of a namespace, follow these steps.

  1. On the left navigation pane, under ADMIN, click Tenants/Namespaces.

  2. Select the name of the tenant that is associated with the target namespace.

  3. Click the name of the namespace that you want to clear backlog for.

  4. Select the OVERVIEW tab.

  5. In the Bundle section, do one of the followings:

    • Click Clean All Backlog to clear the backlog for all the topics of the namespace.

    • Click Clear All Backlog in the Operation column to clear the backlog for all the topics of the namespace bundle.

Configure policies for a namespace

To configure policies for a namespace, follow these steps.

  1. On the left navigation pane, under ADMIN, click Tenants/Namespaces.

  2. Select the name of the tenant that is associated with the target namespace.

  3. Click the name of the namespace that you want to configure the policies for.

  4. Select the POLICY tab.

  5. Configure policies for the namespace, as outlined in the following table.

Field Description
Authorization Grant/Revoke permissions to the Admin roles in this namespace.

Click ADD ROLE to set one or more service accounts as the Admin role of the namespace. Then, you can grant the following permissions to the Admin role.

  • consume: grant/revoke the consuming action.
  • produce: grant/revoke the producing action.
  • functions: grant/revoke the Pulsar functions action.

Click Delete to remove a specific Admin role.

Subscription Authentication Configure the subscription authentication mode to limit the naming convention for subscriptions when authentication is enabled.
  • None: Pulsar clients can use any allowed subscription name to connect to the cluster.
  • Prefix: Pulsar clients can only use subscription names that are prefixed with their role names to subscribe messages.

By default, it is set to None.

Backlog Configure the backlog policy for the namespace.

Backlog Quota Size: configure the maximum backlog quota (in bytes) allowed for the namespace. The backlog quota size must be smaller than 1000000000 bytes. By default, it is set to -1073741824 bytes.

Backlog Retention Policy: configure the backlog retention policy.

  • consumer_backlog_eviction: the broker starts discarding backlog messages.
  • producer_exception: the broker disconnects with the client by giving an exception.
  • producer_request_hold: the broker holds but does not persist producer request payload.
Schema Configure the schema policy for the namespace.
  • Full: backward and forward compatible between the schema V3 and V2.
  • FullTransitive: backward and forward compatible among the schema V3, V2, and V1.
  • Forward: consumers using the schema V3 or V2 can process data written by producers using the schema V3.
  • ForwardTransitive: consumers using the schema V3, V2 or V1 can process data written by producers using the schema V3.
  • Backward: consumers using the schema V3 can process data written by producers using the schema V3 or V2.
  • BackwardTransitive: consumers using the schema V3 can process data written by producers using the schema V3, V2 or V1.
  • AlwaysCompatible: disable schema compatibility check.
  • AutoUpdateDisabled: disable the automatic update strategy of the schema for the namespace.
  • Schema Validation Enforced: enable/disable schema validation for producers without schema. If it is disabled, producers without schema are disallowed to produce messages to topics with schema.
Cleanup Policy Configure the cleanup policy for the namespace.
  • Message TTL (seconds): configure the message TTL in seconds. If messages are not consumed by any consumer of a subscription, they are marked as "consumed" after the configured TTL period expires.
  • Retention Size (MB): configure the retention size. This field only applies to the messages that are acknowledged by all subscriptions. The retention size must be smaller than 1000 MB. By default, it is set to 0.
  • Retention Period (minutes): configure the retention period. This field only applies to the messages that are acknowledged by all subscriptions. By default, it is set to 0.
  • Compaction Threshold (bytes): configure the threshold to compact topics. The compaction is automatically triggered when the threshold is reached. By default, it is set to 0.
Dispatch Rate Dispatch Rate Per Topic: configure the dispatch rate based on the topic.
  • Throughput (bytes/second): configure the dispatch rate of bytes in a topic.
  • Rate (messages/second): configure the dispatch rate of messages in a topic.
  • Time Period (seconds): configure the dispatch rate period.
Dispatch Rate Per Subscription: configure the dispatch rate based on the subscription mode.
  • Throughput (bytes/second): configure the dispatch rate of bytes for a subscription.
  • Rate (messages/second): configure the dispatch rate of messages for a subscription.
  • Time Period (seconds): configure the dispatch rate period.
Subscribe Rate Per Consumer: configure the rate at which a consumer subscribes to a topic.
  • Rate (subscribes/second): configure the rate for a topic that a consumer subscribes to.
  • Time Period (seconds): configure the subscription rate period.

Delete a namespace

You cannot delete a namespace if there are resources associated with the namespace.

To delete a namespace, follow these steps.

  1. On the left navigation pane, under ADMIN, click Tenants/Namespaces.

  2. Select the name of the tenant that is associated with the target namespace.

  3. Click the name of the namespace that you want to delete.

  4. Select the POLICY tab.

  5. In the Warning section at the bottom of the POLICY page, click Delete Namespace. A dialog box displays asking, Are you sure you want to delete this?

  6. Enter the namespace name and then click Confirm.

Next step

Previous
Work with tenants