You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by li...@apache.org on 2023/03/13 01:08:42 UTC
[pulsar-site] branch main updated: [feat][doc] Add *Get Started* for API (Java + REST) and CLI (pulsar-admin) (#462)
This is an automated email from the ASF dual-hosted git repository.
liuyu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git
The following commit(s) were added to refs/heads/main by this push:
new 6f25fd9e70d [feat][doc] Add *Get Started* for API (Java + REST) and CLI (pulsar-admin) (#462)
6f25fd9e70d is described below
commit 6f25fd9e70d8f7be2f7e80e783abc35958cdf538
Author: Anonymitaet <50...@users.noreply.github.com>
AuthorDate: Mon Mar 13 09:08:36 2023 +0800
[feat][doc] Add *Get Started* for API (Java + REST) and CLI (pulsar-admin) (#462)
---
docs/admin-api-features.md | 16 +-
docs/admin-api-overview.md | 12 +-
docs/admin-api-tools.md | 20 +-
...{admin-get-started.md => admin-api-tutorial.md} | 6 +-
docs/admin-api-use-cases.md | 14 +-
docs/admin-get-started.md | 313 +++++++++++++++++----
docs/{admin-get-started.md => admin-tutorial.md} | 6 +-
docs/reference-cli-get-started.md | 219 ++++++++++++++
sidebars.json | 13 +-
9 files changed, 541 insertions(+), 78 deletions(-)
diff --git a/docs/admin-api-features.md b/docs/admin-api-features.md
index be504d6dcd9..4ee6765de72 100644
--- a/docs/admin-api-features.md
+++ b/docs/admin-api-features.md
@@ -23,8 +23,18 @@ Entities|- Topic <br/><br/> - Schema <br/><br/> - Namespace <br/><br/> - Tenant
Stream processing|<br/><br/> - Function <br/><br/> - Connector <br/><br/> - Transaction <br/><br/> - Package | Operations on functions, function workers, or connectors. <br/> For example, <br/> - Create, update, and delete functions or connectors <br/> - Get stats of function workers, trigger rebalance of functions to workers <br/><br/> Operations on transactions. <br/> For example, <br/> - Get stats of transactions <br/> - Update the scale of transaction coordinators <br/><br/> Operatio [...]
Others| - Proxy <br/><br/> - Resource groups <br/><br/> - Resource quotas | Operations on proxy stats. <br/> For example, <br/> - Get various monitoring metrics for proxy stats <br/><br/> Operations on resource groups.<br/>For example, <br/> - Create, update, and delete resource groups <br/><br/>Operations on resource quotas.<br/>For example, <br/> - Set resource quota for namespace bundles
-### Next steps
+### Related topics
-- To perform administrative operations and check details of API references, see [Pulsar admin API - Tools](admin-api-tools.md).
+- To understand the basics, see [Pulsar admin API - Overview](admin-api-overview.md)
-- To get up and running with Pulsar admin APIs quickly, see [Pulsar admin API - Get started](admin-get-started.md).
\ No newline at end of file
+- To learn usage scenarios, see [Pulsar admin API - Use cases](admin-api-use-cases.md).
+
+- To perform administrative operations, see [Pulsar admin API - Tools](admin-api-tools.md).
+
+- To get up quickly, see [Pulsar admin API - Get started](admin-get-started.md).
+
+- To check the detailed usage, see the API references below.
+
+ - [Java admin API](pathname:///api/admin/)
+
+ - [REST API](reference-rest-api-overview.md)
\ No newline at end of file
diff --git a/docs/admin-api-overview.md b/docs/admin-api-overview.md
index b668146a160..7aa001855ad 100644
--- a/docs/admin-api-overview.md
+++ b/docs/admin-api-overview.md
@@ -13,12 +13,18 @@ Pulsar admin APIs enable you to administer clusters programmatically. For exampl
![Pulsar admin APIs - definition](/assets/admin-api-definition.svg)
-### Next steps
+### Related topics
- To learn usage scenarios, see [Pulsar admin API - Use cases](admin-api-use-cases.md).
- To learn common administrative tasks, see [Pulsar admin API - Features](admin-api-features.md).
-- To perform administrative operations and check details of API references, see [Pulsar admin API - Tools](admin-api-tools.md).
+- To perform administrative operations, see [Pulsar admin API - Tools](admin-api-tools.md).
-- To get up and running with Pulsar admin APIs quickly, see [Pulsar admin API - Get started](admin-get-started.md).
\ No newline at end of file
+- To get up quickly, see [Pulsar admin API - Get started](admin-get-started.md).
+
+- To check the detailed usage, see the API references below.
+
+ - [Java admin API](pathname:///api/admin/)
+
+ - [REST API](reference-rest-api-overview.md)
\ No newline at end of file
diff --git a/docs/admin-api-tools.md b/docs/admin-api-tools.md
index b9f3f9106dc..35fc8a466b4 100644
--- a/docs/admin-api-tools.md
+++ b/docs/admin-api-tools.md
@@ -15,7 +15,9 @@ You can manage Pulsar entities through the Pulsar admin layer via one of the fol
- [Java admin API](pathname:///api/admin/): It’s a programmable interface written in Java.
- - [REST API](pathname:///admin-rest-api/?version=@pulsar:version_number@): HTTP calls, which are made against the admin APIs provided by brokers. In addition, both the Java admin API and pulsar-admin CLI use the REST API.
+ - Go admin API (coming soon)
+
+ - [REST API](pathname:///admin-rest-api/?version=@pulsar:version_number@): HTTP calls, which are made against the admin APIs provided by brokers. In addition, both the Java admin API and pulsar-admin CLI use the REST API.
- [pulsar-admin CLI](pathname:///reference/#/@pulsar:version_origin@/pulsar-admin/): It’s a command-line tool and is available in the bin folder of your Pulsar installation.
@@ -29,6 +31,18 @@ Pulsar admin APIs|[Java admin API](pathname:///api/admin/)| - If you want to imp
Pulsar admin APIs | [REST API](pathname:///admin-rest-api/?version=@pulsar:version_number@)|- If you want to implement your own admin interface client using other languages and manage clusters using scripts.| - This method is the most complicated. <br/><br/> - It needs more development work if you want to use it to build applications.
Pulsar admin CLI| [pulsar-admin CLI](pathname:///reference/#/@pulsar:version_origin@/pulsar-admin/) | - If you want to get started with Pulsar admin APIs with minimal effort (e.g., no need to prepare an extra environment). <br/><br/> - If you want to perform common administrative tasks.| - This method is the most easy-to-use. <br/><br/> - It’s challenging to use this method to build applications.<br/><br/> - It takes a little more time because JVM starts slowly.
-### Next steps
+### Related topics
+
+- To understand the basics, see [Pulsar admin API - Overview](admin-api-overview.md)
+
+- To learn usage scenarios, see [Pulsar admin API - Use cases](admin-api-use-cases.md).
+
+- To learn common administrative tasks, see [Pulsar admin API - Features](admin-api-features.md).
+
+- To get up quickly, see [Pulsar admin API - Get started](admin-get-started.md).
+
+- To check the detailed usage, see the API references below.
+
+ - [Java admin API](pathname:///api/admin/)
-- To get up and running with Pulsar admin APIs quickly, see [Pulsar admin API - Get started](admin-get-started.md).
\ No newline at end of file
+ - [REST API](reference-rest-api-overview.md)
\ No newline at end of file
diff --git a/docs/admin-get-started.md b/docs/admin-api-tutorial.md
similarity index 97%
copy from docs/admin-get-started.md
copy to docs/admin-api-tutorial.md
index ab232830684..6cfcec94478 100644
--- a/docs/admin-get-started.md
+++ b/docs/admin-api-tutorial.md
@@ -1,7 +1,7 @@
---
-id: admin-api-get-started
-title: Get started
-sidebar_label: "Get started"
+id: admin-api-tutorial
+title: Tutorial
+sidebar_label: "Tutorial"
---
````mdx-code-block
diff --git a/docs/admin-api-use-cases.md b/docs/admin-api-use-cases.md
index ac9ed2c1572..1d3875f8747 100644
--- a/docs/admin-api-use-cases.md
+++ b/docs/admin-api-use-cases.md
@@ -19,10 +19,18 @@ Pulsar admin APIs are one of the best productivity tools. You can perform variou
![Pulsar admin APIs - use cases](/assets/admin-api-use-cases.svg)
-### Next steps
+### Related topics
+
+- To understand basics, see [Pulsar admin API - Overview](admin-api-overview.md)
- To learn common administrative tasks, see [Pulsar admin API - Features](admin-api-features.md).
-- To perform administrative operations and check details of API references, see [Pulsar admin API - Tools](admin-api-tools.md).
+- To perform administrative operations, see [Pulsar admin API - Tools](admin-api-tools.md).
+
+- To get up quickly, see [Pulsar admin API - Get started](admin-get-started.md).
+
+- To check the detailed usage, see the API references below.
+
+ - [Java admin API](pathname:///api/admin/)
-- To get up and running with Pulsar admin APIs quickly, see [Pulsar admin API - Get started](admin-get-started.md).
\ No newline at end of file
+ - [REST API](reference-rest-api-overview.md)
\ No newline at end of file
diff --git a/docs/admin-get-started.md b/docs/admin-get-started.md
index ab232830684..61ffd7f3151 100644
--- a/docs/admin-get-started.md
+++ b/docs/admin-get-started.md
@@ -9,76 +9,271 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
````
-## Admin setup
+This guide walks you through the quickest way to get started with the following Pulsar admin APIs to manage topics:
-Each of the three admin interfaces (the `pulsar-admin` CLI tool, the [REST API](reference-rest-api-overview.md), and the [Java admin API](pathname:///api/admin/) requires some special setup if you have enabled authentication in your Pulsar instance.
+- Java admin API
+
+- Go admin API (coming soon)
+
+- REST API
````mdx-code-block
<Tabs groupId="api-choice"
- defaultValue="pulsar-admin"
- values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
-<TabItem value="pulsar-admin">
-
-If you have enabled authentication, you need to provide an auth configuration to use the `pulsar-admin` tool. By default, the configuration for the `pulsar-admin` tool is in the [`conf/client.conf`](https://github.com/apache/pulsar/blob/master/conf/client.conf) file. The following are the available parameters:
-
-|Name|Description|Default|
-|----|-----------|-------|
-|webServiceUrl|The web URL for the cluster.|http://localhost:8080/|
-|brokerServiceUrl|The Pulsar protocol URL for the cluster.|pulsar://localhost:6650/|
-|authPlugin|The authentication plugin.| |
-|authParams|The authentication parameters for the cluster, as a comma-separated string.| |
-|useTls|Whether or not TLS authentication will be enforced in the cluster.|false|
-|tlsAllowInsecureConnection|Accept untrusted TLS certificate from client.|false|
-|tlsTrustCertsFilePath|Path for the trusted TLS certificate file.| |
+ defaultValue="Java admin API"
+ values={[{"label":"Java admin API","value":"Java admin API"},{"label":"REST API","value":"REST API"}]}>
+<TabItem value="Java admin API">
+
+This tutorial guides you through every step of using Java admin API to manage topics. It includes the following steps:
+
+1. Initiate a Pulsar Java client.
+
+2. Create a partitioned topic
+
+3. Update the number of a partition.
+
+4. Produce messages to the topic.
+
+5. Check the stats of the topic.
+
+6. Delete the topic.
+
+**Prerequisites**
+
+- Prepare a Java project. You can download one from [Apache Pulsar examples and demos](https://github.com/streamnative/examples).
+
+**Steps**
+
+1. Initiate a Pulsar Java client in your Java project.
+
+ **Input**
+
+ ```java
+ String url = "http://localhost:8080";
+ PulsarAdmin admin = PulsarAdmin.builder()
+ .serviceHttpUrl(url)
+ .build();
+ ```
+
+2. Create a partitioned topic _test-topic-1_ with 4 partitions.
+
+ **Input**
+
+ ```java
+ admin.topics().createPartitionedTopic("persistent://public/default/test-topic-1", 4);
+ ```
+
+3. Update the number of the partition to 5.
+
+ **Input**
+
+ ```java
+ admin.topics().updatePartitionedTopic("test-topic-1", 5);
+ ```
+
+4. Produce some messages to the topic _test-topic-1_.
+
+ **Input**
+
+ ```java
+ PulsarClient client = PulsarClient.builder()
+ .serviceUrl("pulsar://localhost:6650")
+ .build();
+
+ Producer<String> producer = client.newProducer(Schema.STRING)
+ .topic(topic)
+ .blockIfQueueFull(true)
+ .create();
+
+ for (int i = 0; i < 100; ++i) {
+ producer.newMessage().value("test").send();
+ }
+ producer.close();
+ client.close();
+ ```
+
+5. Check the stats of the topic _test-topic-1_.
+
+ **Input**
+
+ ```
+ admin.topics().getPartitionedStats("persistent://public/default/test-topic-1", false)
+ ````
+
+5. Delete the topic _test-topic-1_.
+
+ **Input**
+
+ ```java
+ admin.topics().deletePartitionedTopic("test-topic-1");
+ ```
</TabItem>
<TabItem value="REST API">
-You can find details for the REST API exposed by Pulsar brokers in the [REST API doc](pathname:///admin-rest-api/?version=@pulsar:version_number@).
+This tutorial guides you through every step of using REST API to manage topics. It includes the following steps:
-If you want to test REST APIs in postman, you can use the REST API JSON files [here](pathname:///swagger/).
+1. Create a partitioned topic
-</TabItem>
-<TabItem value="Java">
-
-To use the Java admin API, instantiate a {@inject: javadoc:PulsarAdmin:/admin/org/apache/pulsar/client/admin/PulsarAdmin} object, and specify a URL for a Pulsar broker and a {@inject: javadoc:PulsarAdminBuilder:/admin/org/apache/pulsar/client/admin/PulsarAdminBuilder}. The following is a minimal example using `localhost`.
-
-```java
-String url = "http://localhost:8080";
-// Pass auth-plugin class fully-qualified name if Pulsar-security enabled
-String authPluginClassName = "com.org.MyAuthPluginClass";
-// Pass auth-param if auth-plugin class requires it
-String authParams = "param1=value1";
-boolean tlsAllowInsecureConnection = false;
-String tlsTrustCertsFilePath = null;
-PulsarAdmin admin = PulsarAdmin.builder()
- .authentication(authPluginClassName,authParams)
- .serviceHttpUrl(url)
- .tlsTrustCertsFilePath(tlsTrustCertsFilePath)
- .allowTlsInsecureConnection(tlsAllowInsecureConnection)
- .build();
-```
-
-If you use multiple brokers, you can use multi-host like Pulsar service. For example,
-
-```java
-String url = "http://localhost:8080,localhost:8081,localhost:8082";
-// Below are the same to the line 2 - line 13 in the code snippet above
-// Pass auth-plugin class fully-qualified name if Pulsar-security enabled
-String authPluginClassName = "com.org.MyAuthPluginClass";
-// Pass auth-param if auth-plugin class requires it
-String authParams = "param1=value1";
-boolean tlsAllowInsecureConnection = false;
-String tlsTrustCertsFilePath = null;
-PulsarAdmin admin = PulsarAdmin.builder()
- .authentication(authPluginClassName,authParams)
- .serviceHttpUrl(url)
- .tlsTrustCertsFilePath(tlsTrustCertsFilePath)
- .allowTlsInsecureConnection(tlsAllowInsecureConnection)
- .build();
-```
+2. Update the number of a partition.
+
+3. Produce messages to the topic.
+
+4. Check the stats of the topic.
+
+5. Delete the topic.
+
+**Prerequisites**
+
+- [Install and start Pulsar standalone](getting-started-standalone.md). This tutorial runs Pulsar 2.11 as an example.
+
+**Steps**
+
+1. Create a persistent topic named _test-topic-2_ with 4 partitions.
+
+ **Input**
+
+ ```bash
+ curl -X PUT http://localhost:8080/admin/v2/persistent/public/default/test-topic-2/partitions -H 'Content-Type: application/json' -d "4"
+ ```
+
+ **Output**
+
+ There is no output. You can check the topic in Step 4.
+
+2. Update the number of the partition to 5.
+
+ **Input**
+
+ ```bash
+ curl -X POST http://localhost:8080/admin/v2/persistent/public/default/test-topic-2/partitions -H 'Content-Type: application/json' -d "5"
+ ```
+
+ **Output**
+
+ There is no output. You can check the status of the topic in Step 4.
+
+3. Produce some messages to the partitioned topic _test-topic-2_.
+
+ **Input**
+
+ ```bash
+ bin/pulsar-perf produce -u pulsar://localhost:6650 -r 1000 -i 1000 persistent://public/default/test-topic-2
+ ```
+
+ **Output**
+
+ ```bash
+ 2023-03-08T15:47:06,268+0800 [main] INFO org.apache.pulsar.testclient.PerformanceProducer - Starting Pulsar perf producer with config: {
+ "confFile" : "/Users/yu/apache-pulsar-2.11.0/conf/client.conf",
+ "serviceURL" : "pulsar://localhost:6650",
+ "authPluginClassName" : "",
+ "authParams" : "",
+ "tlsTrustCertsFilePath" : "",
+ "tlsAllowInsecureConnection" : false,
+ "tlsHostnameVerificationEnable" : false,
+ "maxConnections" : 1,
+ "statsIntervalSeconds" : 1000,
+ "ioThreads" : 1,
+ "enableBusyWait" : false,
+ "listenerName" : null,
+ "listenerThreads" : 1,
+ "maxLookupRequest" : 50000,
+ "topics" : [ "persistent://public/default/test-topic-2" ],
+ "numTestThreads" : 1,
+ "msgRate" : 1000,
+ "msgSize" : 1024,
+ "numTopics" : 1,
+ "numProducers" : 1,
+ "separator" : "-",
+ "sendTimeout" : 0,
+ "producerName" : null,
+ "adminURL" : "http://localhost:8080/",
+ "deprecatedAuthPluginClassName" : null,
+ "maxOutstanding" : 0,
+ "maxPendingMessagesAcrossPartitions" : 0,
+ "partitions" : null,
+ "numMessages" : 0,
+ "compression" : "NONE",
+ "payloadFilename" : null,
+ "payloadDelimiter" : "\\n",
+ "batchTimeMillis" : 1.0,
+ "batchMaxMessages" : 1000,
+ "batchMaxBytes" : 4194304,
+ "testTime" : 0,
+ "warmupTimeSeconds" : 1.0,
+ "encKeyName" : null,
+ "encKeyFile" : null,
+ "delay" : 0,
+ "exitOnFailure" : false,
+ "messageKeyGenerationMode" : null,
+ "producerAccessMode" : "Shared",
+ "formatPayload" : false,
+ "formatterClass" : "org.apache.pulsar.testclient.DefaultMessageFormatter",
+ "transactionTimeout" : 10,
+ "numMessagesPerTransaction" : 50,
+ "isEnableTransaction" : false,
+
+ "isAbortTransaction" : false,
+ "histogramFile" : null
+ }
+
+ ...
+
+ 2023-03-08T15:53:28,178+0800 [Thread-0] INFO org.apache.pulsar.testclient.PerformanceProducer - Aggregated latency stats --- Latency: mean: 4.481 ms - med: 2.918 - 95pct: 10.710 - 99pct: 38.928 - 99.9pct: 112.689 - 99.99pct: 154.241 - 99.999pct: 193.249 - Max: 241.717
+ ```
+
+4. Check the internal stats of the topic _test-topic-2_.
+
+ **Input**
+
+ ```bash
+ curl -X GET http://localhost:8080/admin/v2/persistent/public/default/test-topic-2/partitioned-internalStats
+ ```
+
+ **Output**
+
+ For detailed explanations of topic stats, see [Pulsar statistics](administration-stats.md).
+
+ ```bash
+ {"metadata":{"partitions":5},"partitions":{"persistent://public/default/test-topic-2-partition-3":{"entriesAddedCounter":47087,"numberOfEntries":47087,"totalSize":80406959,"currentLedgerEntries":47087,"currentLedgerSize":80406959,"lastLedgerCreatedTimestamp":"2023-03-08T15:47:07.273+08:00","waitingCursorsCount":0,"pendingAddEntriesCount":0,"lastConfirmedEntry":"117:47086","state":"LedgerOpened","ledgers":[{"ledgerId":117,"entries":0,"size":0,"offloaded":false,"underReplicated":false} [...]
+ ```
+
+5. Delete the topic _test-topic-2_.
+
+ **Input**
+
+ ```
+ curl -X DELETE http://localhost:8080/admin/v2/persistent/public/default/test-topic-2/partitions
+ ```
+
+ **Output**
+
+ There is no output. You can verify whether the _test-topic-2_ exists or not using the following command.
+
+ **Input**
+
+ List topics in `public/default` namespace.
+
+ ```
+ curl -X GET http://localhost:8080/admin/v2/persistent/public/default
+ ```
</TabItem>
</Tabs>
-````
+
+## Related topics
+
+- To understand basics, see [Pulsar admin API - Overview](admin-api-overview.md)
+
+- To learn usage scenarios, see [Pulsar admin API - Use cases](admin-api-use-cases.md).
+
+- To learn common administrative tasks, see [Pulsar admin API - Features](admin-api-features.md).
+
+- To perform administrative operations, see [Pulsar admin API - Tools](admin-api-tools.md).
+
+- To check the detailed usage, see the API references below.
+
+ - [Java admin API](pathname:///api/admin/)
+
+ - [REST API](reference-rest-api-overview.md)
\ No newline at end of file
diff --git a/docs/admin-get-started.md b/docs/admin-tutorial.md
similarity index 97%
copy from docs/admin-get-started.md
copy to docs/admin-tutorial.md
index ab232830684..6cfcec94478 100644
--- a/docs/admin-get-started.md
+++ b/docs/admin-tutorial.md
@@ -1,7 +1,7 @@
---
-id: admin-api-get-started
-title: Get started
-sidebar_label: "Get started"
+id: admin-api-tutorial
+title: Tutorial
+sidebar_label: "Tutorial"
---
````mdx-code-block
diff --git a/docs/reference-cli-get-started.md b/docs/reference-cli-get-started.md
new file mode 100644
index 00000000000..c2ac0d37f4c
--- /dev/null
+++ b/docs/reference-cli-get-started.md
@@ -0,0 +1,219 @@
+---
+id: reference-cli-get-started
+title: Get Started
+sidebar_label: "Get started"
+---
+
+This tutorial guides you through every step of using pulsar-admin CLI to manage topics. It includes the following steps:
+
+1. Set the service URL.
+
+2. Create a partitioned topic.
+
+3. Update the number of a partition.
+
+4. Produce messages to the topic.
+
+5. Check the stats of the topic.
+
+6. Delete the topic.
+
+## Prerequisites
+
+- [Install and start Pulsar standalone](getting-started-standalone.md). This tutorial runs Pulsar 2.11 as an example.
+
+## Steps
+
+1. Set the service URLs to point to the broker service in [client.conf](https://github.com/apache/pulsar/blob/master/conf/client.conf).
+
+ ```bash
+ webServiceUrl=http://localhost:8080/
+ brokerServiceUrl=pulsar://localhost:6650/
+ ```
+
+2. Create a persistent topic named test-topic-1 with 6 partitions.
+
+ **Input**
+
+ ```bash
+ bin/pulsar-admin topics create-partitioned-topic \
+ persistent://public/default/test-topic-1 \
+ --partitions 6
+ ```
+
+ **Output**
+
+ There is no output. You can check the status of the topic in Step 5.
+
+3. Update the number of the partition to 8.
+
+ **Input**
+
+ ```bash
+ bin/pulsar-admin topics update-partitioned-topic \
+ persistent://public/default/test-topic-1 \
+ --partitions 8
+ ```
+
+ **Output**
+
+ There is no output. You can check the number of partitions in Step 5.
+
+4. Produce some messages to the partitioned topic test-topic-1.
+
+ **Input**
+
+ ```bash
+ bin/pulsar-perf produce -u pulsar://localhost:6650 -r 1000 -i 1000 persistent://public/default/test-topic-1
+ ```
+
+ **Output**
+
+ ```bash
+ 2023-03-07T15:33:56,832+0800 [main] INFO org.apache.pulsar.testclient.PerformanceProducer - Starting Pulsar perf producer with config: {
+ "confFile" : "/Users/yu/apache-pulsar-2.11.0/conf/client.conf",
+ "serviceURL" : "pulsar://localhost:6650",
+ "authPluginClassName" : "",
+ "authParams" : "",
+ "tlsTrustCertsFilePath" : "",
+ "tlsAllowInsecureConnection" : false,
+ "tlsHostnameVerificationEnable" : false,
+ "maxConnections" : 1,
+ "statsIntervalSeconds" : 1000,
+ "ioThreads" : 1,
+ "enableBusyWait" : false,
+ "listenerName" : null,
+ "listenerThreads" : 1,
+ "maxLookupRequest" : 50000,
+ "topics" : [ "persistent://public/default/test-topic-1" ],
+ "numTestThreads" : 1,
+ "msgRate" : 1000,
+ "msgSize" : 1024,
+ "numTopics" : 1,
+ "numProducers" : 1,
+ "separator" : "-",
+ "sendTimeout" : 0,
+ "producerName" : null,
+ "adminURL" : "http://localhost:8080/",
+
+ ...
+
+ 2023-03-07T15:35:03,769+0800 [Thread-0] INFO org.apache.pulsar.testclient.PerformanceProducer - Aggregated latency stats --- Latency: mean: 8.931 ms - med: 3.775 - 95pct: 32.144 - 99pct: 98.432 - 99.9pct: 216.088 - 99.99pct: 304.807 - 99.999pct: 349.391 - Max: 351.235
+ ```
+
+5. Check the internal stats of the partitioned topic _test-topic-1_.
+
+ **Input**
+
+ ```bash
+ bin/pulsar-admin topics partitioned-stats-internal \
+ persistent://public/default/test-topic-1
+ ```
+
+ **Output**
+
+ Below is a part of the output. For detailed explanations of topic stats, see [Pulsar statistics](administration-stats.md).
+
+ ```bash
+ {
+ "metadata" : {
+ "partitions" : 8
+ },
+ "partitions" : {
+ "persistent://public/default/test-topic-1-partition-1" : {
+ "entriesAddedCounter" : 4213,
+ "numberOfEntries" : 4213,
+ "totalSize" : 8817693,
+ "currentLedgerEntries" : 4212,
+ "currentLedgerSize" : 8806289,
+ "lastLedgerCreatedTimestamp" : "2023-03-07T15:33:59.367+08:00",
+ "waitingCursorsCount" : 0,
+ "pendingAddEntriesCount" : 0,
+ "lastConfirmedEntry" : "65:4211",
+ "state" : "LedgerOpened",
+ "ledgers" : [ {
+ "ledgerId" : 49,
+ "entries" : 1,
+ "size" : 11404,
+ "offloaded" : false,
+ "underReplicated" : false
+ }, {
+ "ledgerId" : 65,
+ "entries" : 0,
+ "size" : 0,
+ "offloaded" : false,
+ "underReplicated" : false
+ } ],
+ "cursors" : {
+ "test-subscriptio-1" : {
+ "markDeletePosition" : "49:-1",
+ "readPosition" : "49:0",
+ "waitingReadOp" : false,
+ "pendingReadOps" : 0,
+ "messagesConsumedCounter" : 0,
+ "cursorLedger" : -1,
+ "cursorLedgerLastEntry" : -1,
+ "individuallyDeletedMessages" : "[]",
+ "lastLedgerSwitchTimestamp" : "2023-03-06T16:41:32.801+08:00",
+ "state" : "NoLedger",
+ "numberOfEntriesSinceFirstNotAckedMessage" : 1,
+ "totalNonContiguousDeletedMessagesRange" : 0,
+ "subscriptionHavePendingRead" : false,
+ "subscriptionHavePendingReplayRead" : false,
+ "properties" : { }
+ },
+ "test-subscription-1" : {
+ "markDeletePosition" : "49:-1",
+ "readPosition" : "49:0",
+ "waitingReadOp" : false,
+ "pendingReadOps" : 0,
+ "messagesConsumedCounter" : 0,
+ "cursorLedger" : -1,
+ "cursorLedgerLastEntry" : -1,
+ "individuallyDeletedMessages" : "[]",
+ "lastLedgerSwitchTimestamp" : "2023-03-06T16:41:32.801+08:00",
+ "state" : "NoLedger",
+ "numberOfEntriesSinceFirstNotAckedMessage" : 1,
+ "totalNonContiguousDeletedMessagesRange" : 0,
+ "subscriptionHavePendingRead" : false,
+ "subscriptionHavePendingReplayRead" : false,
+ "properties" : { }
+ }
+ },
+ "schemaLedgers" : [ ],
+ "compactedLedger" : {
+ "ledgerId" : -1,
+ "entries" : -1,
+ "size" : -1,
+ "offloaded" : false,
+ "underReplicated" : false
+ }
+ },
+ ...
+
+ ```
+
+6. Delete the topic _test-topic-1_.
+
+ **Input**
+
+ ```bash
+ bin/pulsar-admin topics delete-partitioned-topic persistent://public/default/test-topic-1
+ ```
+
+ **Output**
+
+ There is no output. You can verify whether the _test-topic-1_ exists or not using the following command.
+
+ **Input**
+
+ List topics in `public/default` namespace.
+
+ ```bash
+ bin/pulsar-admin topics list public/default
+ ```
+
+## Related topics
+
+To check the detailed usage of pulsar-admin CLI, see [pulsar-admin CLI reference](pathname:///reference/#/@pulsar:version_origin@/).
+
diff --git a/sidebars.json b/sidebars.json
index fd672fcd72f..f3a17c527f2 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -441,6 +441,7 @@
"admin-api-features",
"admin-api-tools",
"admin-api-get-started",
+ "admin-api-tutorial",
"admin-api-clusters",
"admin-api-tenants",
"admin-api-brokers",
@@ -505,7 +506,17 @@
},
"items": [
"reference-terminology",
- "reference-cli-tools",
+ {
+ "type": "category",
+ "label": "CLI tools",
+ "link": {
+ "type": "doc",
+ "id": "reference-cli-tools"
+ },
+ "items": [
+ "reference-cli-get-started"
+ ]
+ },
"reference-configuration",
"reference-metrics",
"reference-rest-api-overview",