From a6e374a40e5391d5737b134fe967d02a73d6ff20 Mon Sep 17 00:00:00 2001 From: Rajan Dhabalia Date: Wed, 26 Jul 2017 22:55:39 -0700 Subject: [PATCH] Remove duplicate cluster-info and bump header for properties (#603) --- .../explanations/persistent-topic-admin.md | 544 ++++++++++++++++++ site/docs/latest/admin/AdminInterface.md | 399 ++----------- 2 files changed, 584 insertions(+), 359 deletions(-) create mode 100644 site/_includes/explanations/persistent-topic-admin.md diff --git a/site/_includes/explanations/persistent-topic-admin.md b/site/_includes/explanations/persistent-topic-admin.md new file mode 100644 index 00000000000..f4563e8ed6c --- /dev/null +++ b/site/_includes/explanations/persistent-topic-admin.md @@ -0,0 +1,544 @@ +Persistent helps to access topic which is a logical endpoint for publishing and consuming messages. Producers publish messages to the topic and consumers subscribe to the topic, to consume messages published to the topic. + +In all of the instructions and commands below, the topic name structure is: + +{% include topic.html p="property" c="cluster" n="namespace" t="topic" %} + +### List of topics + +It provides a list of persistent topics exist under a given namespace. + +#### pulsar-admin + +List of topics can be fetched using [`list`](../../reference/CliTools#list) command. + +```shell +$ pulsar-admin persistent list \ + my-property/my-cluster/my-namespace \ + my-topic +``` + +#### REST API + +{% endpoint GET /admin/persistent/:property/:cluster/:namespace %} + +[More info](../../reference/RestApi#/admin/persistent/:property/:cluster/:namespace) + +#### Java + +```java +String namespace = "my-property/my-cluster-my-namespace"; +admin.persistentTopics().getList(namespace); +``` + +### Grant permission + +It grants permissions on a client role to perform specific actions on a given topic. + +#### pulsar-admin + +Permission can be granted using [`grant-permission`](../../reference/CliTools#grant-permission) command. + +```shell +$ pulsar-admin persistent grant-permission \ + --actions produce,consume --role application1 \ + persistent://test-property/cl1/ns1/tp1 \ + +``` + +#### REST API + +{% endpoint POST /admin/namespaces/:property/:cluster/:namespace/permissions/:role %} + +[More info](../../reference/RestApi#/admin/namespaces/:property/:cluster/:namespace/permissions/:role) + +#### Java + +```java +String destination = "persistent://my-property/my-cluster-my-namespace/my-topic"; +String role = "test-role"; +Set actions = Sets.newHashSet(AuthAction.produce, AuthAction.consume); +admin.persistentTopics().grantPermission(destination, role, actions); +``` + +### Get permission + +Permission can be fetched using [`permissions`](../../reference/CliTools#permissions) command. + +#### pulsar-admin + +TODO: admin + +```shell +$ pulsar-admin persistent permissions \ + persistent://test-property/cl1/ns1/tp1 \ + +{ + "application1": [ + "consume", + "produce" + ] +} +``` + +#### REST API + +{% endpoint GET /admin/namespaces/:property/:cluster/:namespace/permissions %} + +[More info](../../reference/RestApi#/admin/namespaces/:property/:cluster/:namespace/permissions) + +#### Java + +```java +String destination = "persistent://my-property/my-cluster-my-namespace/my-topic"; +admin.persistentTopics().getPermissions(destination); +``` + +### Revoke permission + +It revokes a permission which was granted on a client role. + +#### pulsar-admin + +Permission can be revoked using [`revoke-permission`](../../reference/CliTools#revoke-permission) command. + +```shell +$ pulsar-admin persistent revoke-permission \ + --role application1 \ + persistent://test-property/cl1/ns1/tp1 \ + +{ + "application1": [ + "consume", + "produce" + ] +} +``` + +#### REST API + +{% endpoint DELETE /admin/namespaces/:property/:cluster/:namespace/permissions/:role %} + +[More info](../../reference/RestApi#/admin/namespaces/:property/:cluster/:namespace/permissions/:role) + +#### Java + +```java +String destination = "persistent://my-property/my-cluster-my-namespace/my-topic"; +String role = "test-role"; +admin.persistentTopics().revokePermissions(destination, role); +``` + +### Get stats + +It shows current statistics of a given non-partitioned topic. + + - **msgRateIn**: The sum of all local and replication publishers' publish rates in messages per second + + - **msgThroughputIn**: Same as above, but in bytes per second instead of messages per second + + - **msgRateOut**: The sum of all local and replication consumers' dispatch rates in messages per second + + - **msgThroughputOut**: Same as above, but in bytes per second instead of messages per second + + - **averageMsgSize**: The average size in bytes of messages published within the last interval + + - **storageSize**: The sum of the ledgers' storage size for this topic. See + + - **publishers**: The list of all local publishers into the topic. There can be zero or thousands + + - **averageMsgSize**: Average message size in bytes from this publisher within the last interval + + - **producerId**: Internal identifier for this producer on this topic + + - **producerName**: Internal identifier for this producer, generated by the client library + + - **address**: IP address and source port for the connection of this producer + + - **connectedSince**: Timestamp this producer was created or last reconnected + + - **subscriptions**: The list of all local subscriptions to the topic + + - **my-subscription**: The name of this subscription (client defined) + + - **msgBacklog**: The count of messages in backlog for this subscription + + - **type**: This subscription type + + - **msgRateExpired**: The rate at which messages were discarded instead of dispatched from this subscription due to TTL + + - **consumers**: The list of connected consumers for this subscription + + - **consumerName**: Internal identifier for this consumer, generated by the client library + + - **availablePermits**: The number of messages this consumer has space for in the client library's listen queue. A value of 0 means the client library's queue is full and receive() isn't being called. A nonzero value means this consumer is ready to be dispatched messages. + + - **replication**: This section gives the stats for cross-colo replication of this topic + + - **replicationBacklog**: The outbound replication backlog in messages + + - **connected**: Whether the outbound replicator is connected + + - **replicationDelayInSeconds**: How long the oldest message has been waiting to be sent through the connection, if connected is true + + - **inboundConnection**: The IP and port of the broker in the remote cluster's publisher connection to this broker + + - **inboundConnectedSince**: The TCP connection being used to publish messages to the remote cluster. If there are no local publishers connected, this connection is automatically closed after a minute. + +```json +{ + "msgRateIn": 4641.528542257553, + "msgThroughputIn": 44663039.74947473, + "msgRateOut": 0, + "msgThroughputOut": 0, + "averageMsgSize": 1232439.816728665, + "storageSize": 135532389160, + "publishers": [ + { + "msgRateIn": 57.855383881403576, + "msgThroughputIn": 558994.7078932219, + "averageMsgSize": 613135, + "producerId": 0, + "producerName": null, + "address": null, + "connectedSince": null + } + ], + "subscriptions": { + "my-topic_subscription": { + "msgRateOut": 0, + "msgThroughputOut": 0, + "msgBacklog": 116632, + "type": null, + "msgRateExpired": 36.98245516804671, + "consumers": [] + } + }, + "replication": {} +} +``` + +#### pulsar-admin + +Topic stats can be fetched using [`stats`](../../reference/CliTools#stats) command. + +```shell +$ pulsar-admin persistent stats \ + persistent://test-property/cl1/ns1/tp1 \ +``` + +#### REST API + +{% endpoint GET /admin/persistent/:property/:cluster/:namespace/:destination/stats %} + +[More info](../../reference/RestApi#/admin/persistent/:property/:cluster/:namespace/:destination/stats) + +#### Java + +```java +String destination = "persistent://my-property/my-cluster-my-namespace/my-topic"; +admin.persistentTopics().getStats(destination); +``` + +### Get internal stats + +It shows detailed statistics of a topic. + + - **entriesAddedCounter**: Messages published since this broker loaded this topic + + - **numberOfEntries**: Total number of messages being tracked + + - **totalSize**: Total storage size in bytes of all messages + + - **currentLedgerEntries**: Count of messages written to the ledger currently open for writing + + - **currentLedgerSize**: Size in bytes of messages written to ledger currently open for writing + + - **lastLedgerCreatedTimestamp**: time when last ledger was created + + - **lastLedgerCreationFailureTimestamp:** time when last ledger was failed + + - **waitingCursorsCount**: How many cursors are "caught up" and waiting for a new message to be published + + - **pendingAddEntriesCount**: How many messages have (asynchronous) write requests we are waiting on completion + + - **lastConfirmedEntry**: The ledgerid:entryid of the last message successfully written. If the entryid is -1, then the ledger has been opened or is currently being opened but has no entries written yet. + + - **state**: The state of this ledger for writing. LedgerOpened means we have a ledger open for saving published messages. + + - **ledgers**: The ordered list of all ledgers for this topic holding its messages + + - **cursors**: The list of all cursors on this topic. There will be one for every subscription you saw in the topic stats. + + - **markDeletePosition**: The ack position: the last message the subscriber acknowledged receiving + + - **readPosition**: The latest position of subscriber for reading message + + - **waitingReadOp**: This is true when the subscription has read the latest message published to the topic and is waiting on new messages to be published. + + - **pendingReadOps**: The counter for how many outstanding read requests to the BookKeepers we have in progress + + - **messagesConsumedCounter**: Number of messages this cursor has acked since this broker loaded this topic + + - **cursorLedger**: The ledger being used to persistently store the current markDeletePosition + + - **cursorLedgerLastEntry**: The last entryid used to persistently store the current markDeletePosition + + - **individuallyDeletedMessages**: If Acks are being done out of order, shows the ranges of messages Acked between the markDeletePosition and the read-position + + - **lastLedgerSwitchTimestamp**: The last time the cursor ledger was rolled over + + - **state**: The state of the cursor ledger: Open means we have a cursor ledger for saving updates of the markDeletePosition. + +```json +{ + "entriesAddedCounter": 20449518, + "numberOfEntries": 3233, + "totalSize": 331482, + "currentLedgerEntries": 3233, + "currentLedgerSize": 331482, + "lastLedgerCreatedTimestamp": "2016-06-29 03:00:23.825", + "lastLedgerCreationFailureTimestamp": null, + "waitingCursorsCount": 1, + "pendingAddEntriesCount": 0, + "lastConfirmedEntry": "324711539:3232", + "state": "LedgerOpened", + "ledgers": [ + { + "ledgerId": 324711539, + "entries": 0, + "size": 0 + } + ], + "cursors": { + "my-subscription": { + "markDeletePosition": "324711539:3133", + "readPosition": "324711539:3233", + "waitingReadOp": true, + "pendingReadOps": 0, + "messagesConsumedCounter": 20449501, + "cursorLedger": 324702104, + "cursorLedgerLastEntry": 21, + "individuallyDeletedMessages": "[(324711539:3134‥324711539:3136], (324711539:3137‥324711539:3140], ]", + "lastLedgerSwitchTimestamp": "2016-06-29 01:30:19.313", + "state": "Open" + } + } +} +``` + + +#### pulsar-admin + +Topic internal-stats can be fetched using [`stats-internal`](../../reference/CliTools#stats-internal) command. + +```shell +$ pulsar-admin persistent stats-internal \ + persistent://test-property/cl1/ns1/tp1 \ +``` + +#### REST API + +{% endpoint GET /admin/persistent/:property/:cluster/:namespace/:destination/internalStats %} + +[More info](../../reference/RestApi#/admin/persistent/:property/:cluster/:namespace/:destination/internalStats) + +#### Java + +```java +String destination = "persistent://my-property/my-cluster-my-namespace/my-topic"; +admin.persistentTopics().getInternalStats(destination); +``` + +### Peek messages + +It peeks N messages for a specific subscription of a given topic. + +#### pulsar-admin + + +```shell +$ pulsar-admin persistent peek-messages \ + --count 10 --subscription my-subscription \ + persistent://test-property/cl1/ns1/tp1 \ + +Message ID: 315674752:0 +Properties: { "X-Pulsar-publish-time" : "2015-07-13 17:40:28.451" } +msg-payload +``` + +#### REST API + +{% endpoint GET /admin/persistent/:property/:cluster/:namespace/:destination/subscription/:subName/position/:messagePosition %} + +[More info](../../reference/RestApi#/admin/persistent/:property/:cluster/:namespace/:destination/subscription/:subName/position/:messagePosition) + +#### Java + +```java +String destination = "persistent://my-property/my-cluster-my-namespace/my-topic"; +String subName = "my-subscription"; +int numMessages = 1; +admin.persistentTopics().peekMessages(destination, subName, numMessages); +``` + +### Skip messages + +It skips N messages for a specific subscription of a given topic. + +#### pulsar-admin + + +```shell +$ pulsar-admin persistent skip \ + --count 10 --subscription my-subscription \ + persistent://test-property/cl1/ns1/tp1 \ +``` + +#### REST API + +{% endpoint POST /admin/persistent/:property/:cluster/:namespace/:destination/subscription/:subName/skip/:numMessages %} + +[More info](../../reference/RestApi#/admin/persistent/:property/:cluster/:namespace/:destination/subscription/:subName/skip/:numMessages) + +#### Java + +```java +String destination = "persistent://my-property/my-cluster-my-namespace/my-topic"; +String subName = "my-subscription"; +int numMessages = 1; +admin.persistentTopics().skipMessages(destination, subName, numMessages); +``` + +### Skip all messages + +It skips all old messages for a specific subscription of a given topic. + +#### pulsar-admin + + +```shell +$ pulsar-admin persistent skip-all \ + --subscription my-subscription \ + persistent://test-property/cl1/ns1/tp1 \ +``` + +#### REST API + +{% endpoint POST /admin/persistent/:property/:cluster/:namespace/:destination/subscription/:subName/skip_all %} + +[More info](../../reference/RestApi#/admin/persistent/:property/:cluster/:namespace/:destination/subscription/:subName/skip_all) + +#### Java + +```java +String destination = "persistent://my-property/my-cluster-my-namespace/my-topic"; +String subName = "my-subscription"; +admin.persistentTopics().skipAllMessages(destination, subName); +``` + +### Reset cursor + +It resets a subscription’s cursor position back to the position which was recorded X minutes before. It essentially calculates time and position of cursor at X minutes before and resets it at that position. + +#### pulsar-admin + + +```shell +$ pulsar-admin persistent reset-cursor \ + --subscription my-subscription --time 10 \ + persistent://test-property/cl1/ns1/tp1 \ +``` + +#### REST API + +{% endpoint POST /admin/persistent/:property/:cluster/:namespace/:destination/subscription/:subName/resetcursor/:timestamp %} + +[More info](../../reference/RestApi#/admin/persistent/:property/:cluster/:namespace/:destination/subscription/:subName/resetcursor/:timestamp) + +#### Java + +```java +String destination = "persistent://my-property/my-cluster-my-namespace/my-topic"; +String subName = "my-subscription"; +long timestamp = 2342343L; +admin.persistentTopics().skipAllMessages(destination, subName, timestamp); +``` + +### Lookup of topic + +It locates broker url which is serving the given topic. + +#### pulsar-admin + + +```shell +$ pulsar-admin persistent lookup \ + persistent://test-property/cl1/ns1/tp1 \ + + "pulsar://broker1.org.com:4480" +``` + +#### REST API + +{% endpoint GET /lookup/v2/destination/persistent/:property/:cluster/:namespace/:destination %} + +#### Java + +```java +String destination = "persistent://my-property/my-cluster-my-namespace/my-topic"; +admin.lookup().lookupDestination(destination); +``` + +### Get subscriptions + +It shows all subscription names for a given topic. + +#### pulsar-admin + +```shell +$ pulsar-admin persistent subscriptions \ + persistent://test-property/cl1/ns1/tp1 \ + + my-subscription +``` + +#### REST API + +{% endpoint GET /admin/persistent/:property/:cluster/:namespace/:destination/subscriptions %} + +[More info](../../reference/RestApi#/admin/persistent/:property/:cluster/:namespace/:destination/subscriptions) + +#### Java + +```java +String destination = "persistent://my-property/my-cluster-my-namespace/my-topic"; +admin.persistentTopics().getSubscriptions(destination); +``` + +### Unsubscribe + +It can also help to unsubscribe a subscription which is no more processing further messages. + +#### pulsar-admin + + +```shell +$ pulsar-admin persistent unsubscribe \ + --subscription my-subscription \ + persistent://test-property/cl1/ns1/tp1 \ +``` + +#### REST API + +{% endpoint POST /admin/namespaces/:property/:cluster/:namespace/unsubscribe/:subscription %} + +[More info](../../reference/RestApi#/admin/namespaces/:property/:cluster/:namespace/unsubscribe/:subscription) + +#### Java + +```java +String destination = "persistent://my-property/my-cluster-my-namespace/my-topic"; +String subscriptionName = "my-subscription"; +admin.persistentTopics().deleteSubscription(destination, subscriptionName); +``` \ No newline at end of file diff --git a/site/docs/latest/admin/AdminInterface.md b/site/docs/latest/admin/AdminInterface.md index 710c891ac6b..8d88f4bba65 100644 --- a/site/docs/latest/admin/AdminInterface.md +++ b/site/docs/latest/admin/AdminInterface.md @@ -34,7 +34,7 @@ In this document, examples from each of the three available interfaces will be s {% include explanations/broker-admin.md %} -### Properties +## Managing Properties A property identifies an application domain. For e.g. finance, mail, sports etc are examples of a property. Tool allows to do CRUD operation @@ -175,37 +175,20 @@ N/A admin.properties().deleteProperty(property); ``` -### Clusters - -{% include explanations/cluster-admin.md %} - ## Managing namespaces {% include explanations/namespace-admin.md %} -## Managing peristent topics - -Persistent helps to access topic which is a logical endpoint for -publishing and consuming messages. Producers publish messages to the -topic and consumers subscribe to the topic, to consume messages -published to the topic. - -In below instructions and commands - persistent topic format is: - -{% include topic.html p="property" c="cluster" n="namespace" t="topic" %} - -{% include explanations/partitioned-topics.md %} - -## Permissions +### Resource-Quotas -#### Grant permission +#### set namespace resource quota -It grants permissions on a client role to perform specific actions on a given topic. +It sets customize quota information for a given namespace bundle. ###### CLI ``` -$ pulsar-admin persistent grant-permission --actions produce,consume --role application1 persistent://test-property/cl1/ns1/tp1 +$ pulsar-admin resource-quotas set --bandwidthIn 10 --bandwidthOut 10 --bundle 0x00000000_0xffffffff --memory 10 --msgRateIn 10 --msgRateOut 10 --namespace test-property/cl1/ns1 ``` ``` @@ -215,216 +198,55 @@ N/A ###### REST ``` -POST /admin/persistent/{property}/{cluster}/{namespace}/{destination}/permissions/{role} +POST /admin/resource-quotas/{property}/{cluster}/{namespace}/{bundle} ``` ###### Java ```java -admin.persistentTopics().grantPermission(destination, role, getAuthActions(actions)) +admin.resourceQuotas().setNamespaceBundleResourceQuota(namespace, bundle, quota) ``` -#### Get permission +#### get namespace resource quota -It shows a list of client role permissions on a given topic. +It shows configured resource quota information. ###### CLI ``` -$ pulsar-admin permissions persistent://test-property/cl1/ns1/tp1 +$ pulsar-admin resource-quotas get --bundle 0x00000000_0xffffffff --namespace test-property/cl1/my-topic ``` ```json { - "application1": [ - "consume", - "produce" - ] -} -``` - -###### REST - -``` -GET /admin/persistent/{property}/{cluster}/{namespace}/{destination}/permissions -``` - -###### Java - -```java -admin.persistentTopics().getPermissions(destination) -``` - -#### Revoke permission - -It revokes a permission which was granted on a client role. - -###### CLI - -``` -$ pulsar-admin persistent revoke-permission --role application1 persistent://test-property/cl1/ns1/tp1 -``` - -``` -N/A -``` - -###### REST - -``` -DELETE /admin/persistent/{property}/{cluster}/{namespace}/{destination}/permissions/{role} -``` - -###### Java - -```java -admin.persistentTopics().revokePermissions(destination, role) -``` - -#### Peek messages - -It peeks N messages for a specific subscription of a given topic. - -###### CLI - -``` -$ pulsar-admin persistent peek-messages --count 10 --subscription my-subscription persistent://test-property/cl1/ns1/my-topic -``` - -``` -Message ID: 315674752:0 -Properties: { "X-Pulsar-publish-time" : "2015-07-13 17:40:28.451" } -msg-payload -``` - -###### REST - -``` -GET /admin/persistent/{property}/{cluster}/{namespace}/{destination}/subscription/{subName}/position/{messagePosition} -``` - - -###### Java - -```java -admin.persistentTopics().peekMessages(persistentTopic, subName, numMessages) -``` - - -#### Skip messages - -It skips N messages for a specific subscription of a given topic. - -###### CLI - -``` -$ pulsar-admin persistent skip --count 10 --subscription my-subscription persistent://test-property/cl1/ns1/my-topic -``` - -``` -N/A -``` - -###### REST - -``` -POST /admin/persistent/{property}/{cluster}/{namespace}/{destination}/subscription/{subName}/skip/{numMessages} -``` - -###### Java - -```java -admin.persistentTopics().skipMessages(persistentTopic, subName, numMessages) -``` - -#### Skip all messages - -It skips all old messages for a specific subscription of a given topic. - -###### CLI - -``` -$ pulsar-admin persistent skip-all --subscription my-subscription persistent://test-property/cl1/ns1/my-topic -``` - -``` -N/A -``` - -###### REST - -``` -POST /admin/persistent/{property}/{cluster}/{namespace}/{destination}/subscription/{subName}/skip_all -``` - -###### Java - -```java -admin.persistentTopics().skipAllMessages(persistentTopic, subName) -``` - -#### Expire messages - -It expires messages which are older than given expiry time (in seconds) for a specific subscription of a given topic. - -###### CLI - -``` -$ pulsar-admin persistent expire-messages --subscription my-subscription --expireTime 120 persistent://test-property/cl1/ns1/my-topic -``` - -``` -N/A -``` - -###### REST - -``` -POST /admin/persistent/{property}/{cluster}/{namespace}/{destination}/subscription/{subName}/expireMessages/{expireTimeInSeconds} -``` - -###### Java - -```java -admin.persistentTopics().expireMessages(persistentTopic, subName, expireTimeInSeconds) -``` - -#### Expire all messages - -It expires messages which are older than given expiry time (in seconds) for all subscriptions of a given topic. - -###### CLI - -``` -$ pulsar-admin persistent expire-messages-all-subscriptions --expireTime 120 persistent://test-property/cl1/ns1/my-topic -``` - -``` -N/A + "msgRateIn": 80.40352101165782, + "msgRateOut": 132.58187392933146, + "bandwidthIn": 144273.8819600397, + "bandwidthOut": 234497.9190227951, + "memory": 199.91739142481595, + "dynamic": true +} ``` ###### REST - ``` -POST /admin/persistent/{property}/{cluster}/{namespace}/{destination}/all_subscription/expireMessages/{expireTimeInSeconds} +GET /admin/resource-quotas/{property}/{cluster}/{namespace}/{bundle} ``` ###### Java ```java -admin.persistentTopics().expireMessagesForAllSubscriptions(persistentTopic, expireTimeInSeconds) +admin.resourceQuotas().getNamespaceBundleResourceQuota(namespace, bundle) ``` +#### reset namespace resource quota - -#### Reset cursor - -It resets a subscription’s cursor position back to the position which was recorded X minutes before. It essentially calculates time and position of cursor at X minutes before and resets it at that position. +It again reverts back the customized resource quota and sets back default resource_quota. ###### CLI ``` -$ pulsar-admin persistent reset-cursor --subscription my-subscription --time 10 persistent://test-property/pstg-gq1/ns1/my-topic +$ pulsar-admin resource-quotas reset-namespace-bundle-quota --bundle 0x00000000_0xffffffff --namespace test-property/cl1/my-topic ``` ``` @@ -434,94 +256,27 @@ N/A ###### REST ``` -POST /admin/persistent/{property}/{cluster}/{namespace}/{destination}/subscription/{subName}/resetcursor/{timestamp} -``` - -###### Java - -```java -admin.persistentTopics().resetCursor(persistentTopic, subName, timestamp) -``` - - -#### Lookup of topic - - -It locates broker url which is serving the given topic. - -###### CLI - -``` -$ pulsar-admin persistent lookup persistent://test-property/pstg-gq1/ns1/my-topic -``` - -``` -"pulsar://broker1.org.com:4480" -``` - -###### REST -``` -GET http://:/lookup/v2/destination/persistent/{property}/{cluster}/{namespace}/{dest} -(\* this api serves by “lookup” resource and not “persistent”) -``` - -###### Java - -```java -admin.lookups().lookupDestination(destination) -``` - -#### Get subscriptions - -It shows all subscription names for a given topic. - -###### CLI - -``` -$ pulsar-admin persistent subscriptions persistent://test-property/pstg-gq1/ns1/my-topic -``` - -``` -my-subscription -``` - -###### REST - -``` -GET /admin/persistent/{property}/{cluster}/{namespace}/{destination}/subscriptions +DELETE /admin/resource-quotas/{property}/{cluster}/{namespace}/{bundle} ``` ###### Java ```java -admin.persistentTopics().getSubscriptions(persistentTopic) -``` - -#### unsubscribe - -It can also help to unsubscribe a subscription which is no more processing further messages. - -###### CLI - -``` -$pulsar-admin persistent unsubscribe --subscription my-subscription persistent://test-property/pstg-gq1/ns1/my-topic +admin.resourceQuotas().resetNamespaceBundleResourceQuota(namespace, bundle) ``` -``` -N/A -``` +## Managing peristent topics -###### REST +Persistent helps to access topic which is a logical endpoint for +publishing and consuming messages. Producers publish messages to the +topic and consumers subscribe to the topic, to consume messages +published to the topic. -``` -DELETE /admin/persistent/{property}/{cluster}/{namespace}/{destination}/subscription/{subName} -``` +In below instructions and commands - persistent topic format is: -###### Java +{% include topic.html p="property" c="cluster" n="namespace" t="topic" %} -```java -admin.persistentTopics().deleteSubscription(persistentTopic, subName) -``` +{% include explanations/persistent-topic-admin.md %} ### Namespace isolation policy @@ -675,93 +430,19 @@ GET /admin/clusters/{cluster}/namespaceIsolationPolicies admin.clusters().getNamespaceIsolationPolicies(clusterName) ``` +## Managing partitioned topics -### Resource-Quotas - -#### set namespace resource quota - -It sets customize quota information for a given namespace bundle. +Partitioned topic is actually implemented as N internal topics, where N is the number of partitions. +When publishing messages to a partitioned topic, each message is routed to one of several brokers. +The distribution of partitions across brokers is handled automatically by Pulsar. -###### CLI - -``` -$ pulsar-admin resource-quotas set --bandwidthIn 10 --bandwidthOut 10 --bundle 0x00000000_0xffffffff --memory 10 --msgRateIn 10 --msgRateOut 10 --namespace test-property/cl1/ns1 -``` - -``` -N/A -``` - -###### REST - -``` -POST /admin/resource-quotas/{property}/{cluster}/{namespace}/{bundle} -``` - -###### Java - -```java -admin.resourceQuotas().setNamespaceBundleResourceQuota(namespace, bundle, quota) -``` - -#### get namespace resource quota - -It shows configured resource quota information. - -###### CLI - -``` -$ pulsar-admin resource-quotas get --bundle 0x00000000_0xffffffff --namespace test-property/cl1/my-topic -``` - -```json -{ - "msgRateIn": 80.40352101165782, - "msgRateOut": 132.58187392933146, - "bandwidthIn": 144273.8819600397, - "bandwidthOut": 234497.9190227951, - "memory": 199.91739142481595, - "dynamic": true -} -``` - -###### REST -``` -GET /admin/resource-quotas/{property}/{cluster}/{namespace}/{bundle} -``` - -###### Java - -```java -admin.resourceQuotas().getNamespaceBundleResourceQuota(namespace, bundle) -``` - -#### reset namespace resource quota - -It again reverts back the customized resource quota and sets back default resource_quota. - -###### CLI - -``` -$ pulsar-admin resource-quotas reset-namespace-bundle-quota --bundle 0x00000000_0xffffffff --namespace test-property/cl1/my-topic -``` - -``` -N/A -``` - -###### REST +In below instructions and commands - persistent topic format is: -``` -DELETE /admin/resource-quotas/{property}/{cluster}/{namespace}/{bundle} -``` +{% include topic.html p="property" c="cluster" n="namespace" t="topic" %} -###### Java +{% include explanations/partitioned-topics.md %} -```java -admin.resourceQuotas().resetNamespaceBundleResourceQuota(namespace, bundle) -``` -## Partitioned topics +### Partitioned topics {% include explanations/partitioned-topic-admin.md %} -- GitLab