Huanli-Meng commented on code in PR #504:
URL: https://github.com/apache/pulsar-site/pull/504#discussion_r1161374085
##########
docs/admin-get-started.md:
##########
@@ -9,102 +9,245 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
````
-This guide walks you through the quickest way to get started with the
following Pulsar admin APIs to manage topics:
+This guide walks you through the quickest way to get started with the
following methods to manage topics.
-- Java admin 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">
+
+[pulsar-admin
CLI](pathname:///reference/#/@pulsar:version_reference@/pulsar-admin/): it’s a
command-line tool and is available in the bin folder of your Pulsar
installation.
+
+</TabItem>
+<TabItem value="REST API">
+
+[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.
+
+</TabItem>
+<TabItem value="Java">
+
+[Java admin API](/api/admin/): it’s a programmable interface written in Java.
+
+</TabItem>
-- Go admin API (coming soon)
+</Tabs>
+````
-- REST API
+Check the detailed steps below.
````mdx-code-block
<Tabs groupId="api-choice"
- defaultValue="Java admin API"
- values={[{"label":"Java admin API","value":"Java admin API"},{"label":"REST
API","value":"REST API"}]}>
-<TabItem value="Java admin API">
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST
API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
-This tutorial guides you through every step of using Java admin API to manage
topics. It includes the following steps:
+This tutorial guides you through every step of using pulsar-admin CLI to
manage topics. It includes the following steps:
-1. Initiate a Pulsar Java client.
+1. Set the service URL.
-2. Create a partitioned topic
+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.
+6. Delete the topic.
**Prerequisites**
-- Prepare a Java project. You can download one from [Apache Pulsar examples
and demos](https://github.com/streamnative/examples).
+- Install and start Pulsar standalone. This tutorial runs Pulsar 2.11 as an
example.
**Steps**
-1. Initiate a Pulsar Java client in your Java project.
+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.
Review Comment:
```suggestion
2. Create a persistent topic named _test-topic-1_ with 6 partitions.
```
##########
docs/admin-get-started.md:
##########
@@ -9,102 +9,245 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
````
-This guide walks you through the quickest way to get started with the
following Pulsar admin APIs to manage topics:
+This guide walks you through the quickest way to get started with the
following methods to manage topics.
-- Java admin 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">
+
+[pulsar-admin
CLI](pathname:///reference/#/@pulsar:version_reference@/pulsar-admin/): it’s a
command-line tool and is available in the bin folder of your Pulsar
installation.
+
+</TabItem>
+<TabItem value="REST API">
+
+[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.
+
+</TabItem>
+<TabItem value="Java">
+
+[Java admin API](/api/admin/): it’s a programmable interface written in Java.
+
+</TabItem>
-- Go admin API (coming soon)
+</Tabs>
+````
-- REST API
+Check the detailed steps below.
````mdx-code-block
<Tabs groupId="api-choice"
- defaultValue="Java admin API"
- values={[{"label":"Java admin API","value":"Java admin API"},{"label":"REST
API","value":"REST API"}]}>
-<TabItem value="Java admin API">
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST
API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
-This tutorial guides you through every step of using Java admin API to manage
topics. It includes the following steps:
+This tutorial guides you through every step of using pulsar-admin CLI to
manage topics. It includes the following steps:
-1. Initiate a Pulsar Java client.
+1. Set the service URL.
-2. Create a partitioned topic
+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.
+6. Delete the topic.
**Prerequisites**
-- Prepare a Java project. You can download one from [Apache Pulsar examples
and demos](https://github.com/streamnative/examples).
+- Install and start Pulsar standalone. This tutorial runs Pulsar 2.11 as an
example.
**Steps**
-1. Initiate a Pulsar Java client in your Java project.
+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**
- ```java
- String url = "http://localhost:8080";
- PulsarAdmin admin = PulsarAdmin.builder()
- .serviceHttpUrl(url)
- .build();
+ ```bash
+ bin/pulsar-admin topics create-partitioned-topic \
+ persistent://public/default/test-topic-1 \
+ --partitions 6
```
-2. Create a partitioned topic _test-topic-1_ with 4 partitions.
+ **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**
- ```java
-
admin.topics().createPartitionedTopic("persistent://public/default/test-topic-1",
4);
+ ```bash
+ bin/pulsar-admin topics update-partitioned-topic \
+ persistent://public/default/test-topic-1 \
+ --partitions 8
```
-3. Update the number of the partition to 5.
+ **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**
- ```java
- admin.topics().updatePartitionedTopic("test-topic-1", 5);
+ ```bash
+ bin/pulsar-perf produce -u pulsar://localhost:6650 -r 1000 -i 1000
persistent://public/default/test-topic-1
```
-4. Produce some messages to the topic _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**
- ```java
- PulsarClient client = PulsarClient.builder()
- .serviceUrl("pulsar://localhost:6650")
- .build();
+ ```bash
+ bin/pulsar-admin topics partitioned-stats-internal \
+ persistent://public/default/test-topic-1
+ ```
- Producer<String> producer = client.newProducer(Schema.STRING)
- .topic(topic)
- .blockIfQueueFull(true)
- .create();
+ **Output**
- for (int i = 0; i < 100; ++i) {
- producer.newMessage().value("test").send();
- }
- producer.close();
- client.close();
+ Below is a part of the output. For detailed explanations of topic stats,
see Pulsar statistics.
Review Comment:
I would suggest that we can add a link to Pulsar statistics.
##########
docs/admin-get-started.md:
##########
@@ -9,102 +9,245 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
````
-This guide walks you through the quickest way to get started with the
following Pulsar admin APIs to manage topics:
+This guide walks you through the quickest way to get started with the
following methods to manage topics.
-- Java admin 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">
+
+[pulsar-admin
CLI](pathname:///reference/#/@pulsar:version_reference@/pulsar-admin/): it’s a
command-line tool and is available in the bin folder of your Pulsar
installation.
+
+</TabItem>
+<TabItem value="REST API">
+
+[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.
+
+</TabItem>
+<TabItem value="Java">
+
+[Java admin API](/api/admin/): it’s a programmable interface written in Java.
+
+</TabItem>
-- Go admin API (coming soon)
+</Tabs>
+````
-- REST API
+Check the detailed steps below.
````mdx-code-block
<Tabs groupId="api-choice"
- defaultValue="Java admin API"
- values={[{"label":"Java admin API","value":"Java admin API"},{"label":"REST
API","value":"REST API"}]}>
-<TabItem value="Java admin API">
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST
API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
-This tutorial guides you through every step of using Java admin API to manage
topics. It includes the following steps:
+This tutorial guides you through every step of using pulsar-admin CLI to
manage topics. It includes the following steps:
-1. Initiate a Pulsar Java client.
+1. Set the service URL.
-2. Create a partitioned topic
+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.
+6. Delete the topic.
**Prerequisites**
-- Prepare a Java project. You can download one from [Apache Pulsar examples
and demos](https://github.com/streamnative/examples).
+- Install and start Pulsar standalone. This tutorial runs Pulsar 2.11 as an
example.
**Steps**
-1. Initiate a Pulsar Java client in your Java project.
+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**
- ```java
- String url = "http://localhost:8080";
- PulsarAdmin admin = PulsarAdmin.builder()
- .serviceHttpUrl(url)
- .build();
+ ```bash
+ bin/pulsar-admin topics create-partitioned-topic \
+ persistent://public/default/test-topic-1 \
+ --partitions 6
```
-2. Create a partitioned topic _test-topic-1_ with 4 partitions.
+ **Output**
Review Comment:
I would suggest we use the note to tell users there is no output here
instead of using **Output** here. same comments for the next step.
##########
docs/admin-get-started.md:
##########
@@ -9,102 +9,245 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
````
-This guide walks you through the quickest way to get started with the
following Pulsar admin APIs to manage topics:
+This guide walks you through the quickest way to get started with the
following methods to manage topics.
-- Java admin 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">
+
+[pulsar-admin
CLI](pathname:///reference/#/@pulsar:version_reference@/pulsar-admin/): it’s a
command-line tool and is available in the bin folder of your Pulsar
installation.
+
+</TabItem>
+<TabItem value="REST API">
+
+[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.
+
+</TabItem>
+<TabItem value="Java">
+
+[Java admin API](/api/admin/): it’s a programmable interface written in Java.
+
+</TabItem>
-- Go admin API (coming soon)
+</Tabs>
+````
-- REST API
+Check the detailed steps below.
````mdx-code-block
<Tabs groupId="api-choice"
- defaultValue="Java admin API"
- values={[{"label":"Java admin API","value":"Java admin API"},{"label":"REST
API","value":"REST API"}]}>
-<TabItem value="Java admin API">
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST
API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
-This tutorial guides you through every step of using Java admin API to manage
topics. It includes the following steps:
+This tutorial guides you through every step of using pulsar-admin CLI to
manage topics. It includes the following steps:
-1. Initiate a Pulsar Java client.
+1. Set the service URL.
-2. Create a partitioned topic
+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.
+6. Delete the topic.
**Prerequisites**
-- Prepare a Java project. You can download one from [Apache Pulsar examples
and demos](https://github.com/streamnative/examples).
+- Install and start Pulsar standalone. This tutorial runs Pulsar 2.11 as an
example.
**Steps**
-1. Initiate a Pulsar Java client in your Java project.
+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**
- ```java
- String url = "http://localhost:8080";
- PulsarAdmin admin = PulsarAdmin.builder()
- .serviceHttpUrl(url)
- .build();
+ ```bash
+ bin/pulsar-admin topics create-partitioned-topic \
+ persistent://public/default/test-topic-1 \
+ --partitions 6
```
-2. Create a partitioned topic _test-topic-1_ with 4 partitions.
+ **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**
- ```java
-
admin.topics().createPartitionedTopic("persistent://public/default/test-topic-1",
4);
+ ```bash
+ bin/pulsar-admin topics update-partitioned-topic \
+ persistent://public/default/test-topic-1 \
+ --partitions 8
```
-3. Update the number of the partition to 5.
+ **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.
Review Comment:
```suggestion
4. Produce some messages to the partitioned topic _test-topic-1_.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]