momo-jun commented on code in PR #16725: URL: https://github.com/apache/pulsar/pull/16725#discussion_r927233417
########## site2/docs/administration-pulsar-shell.md: ########## @@ -0,0 +1,174 @@ +--- +id: administration-pulsar-shell +title: Pulsar Shell +sidebar_label: "Pulsar Shell" +--- + +````mdx-code-block +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +```` + + +Pulsar shell is a fast and flexible shell for Pulsar cluster management, messaging, and more. +It's great for quickly switching between different clusters, and can modify cluster or tenant configurations in an instant. + + +# Features +- Administration: find all the [Admin API](admin-api-overview.md) features under the `admin` command . +- Client: find all the [pulsar-client](reference-cli-tools#pulsar-client.md) features under the `client` command. + + +# Installation + +Download the tarball from the [download page](https://pulsar.apache.org/download) and extract it. + +```shell +wget https://archive.apache.org/dist/pulsar/pulsar-@pulsar:version@/apache-pulsar-shell-@pulsar:[email protected] +tar xzvf apache-pulsar-shell-@pulsar:[email protected] +cd apache-pulsar-shell-@pulsar:[email protected] +``` + +Now you can enter Pulsar shell's interactive mode: + +```shell +$ ./bin/pulsar-shell +Welcome to Pulsar shell! + Service URL: pulsar://localhost:6650/ + Admin URL: http://localhost:8080/ + +Type help to get started or try the autocompletion (TAB button). +Type exit or quit to end the shell session. + +default(localhost)> +``` + + +# Connect to your cluster + +By default, the shell will try to connect to a local Pulsar instance. +To connect to a different cluster, you have to register the cluster with Pulsar shell. You can do this in a few different ways depending on where your config file is located: + +> The configuration file must be a valid `client.conf` file, the same one you use for `pulsar-admin`, `pulsar-client` and other client tools. + +````mdx-code-block +<Tabs groupId="shell-config-modes" + defaultValue="url" + values={[{"label":"Remote URL","value":"url"},{"label":"File","value":"file"},{"label":"Inline","value":"inline"}]}> +<TabItem value="url"> + + +The `--url` value must point to a valid remote file. + + +``` +default(localhost)> config create --url https://<url_to_my_client.conf> mycluster +``` + +</TabItem> +<TabItem value="file"> + +If the file is on your local machine, use the `--file` option. + + +``` +default(localhost)> config create --file ./my-cluster-my-client.conf mycluster +``` + +</TabItem> +<TabItem value="inline"> + +You can encode the content of the config to base64 and specify it with the `--value` option. + +``` +default(localhost)> config create --value "base64:<client.conf_base64_encoded>" mycluster +``` + + +</TabItem> + +</Tabs> +```` + + +Once you've configured your cluster, set it as current: + +``` +default(localhost)> config use mycluster +Welcome to Pulsar shell! + Service URL: pulsar+ssl://mycluster:6651/ + Admin URL: https://mycluster:8443/ + +Type help to get started or try the autocompletion (TAB button). +Type exit or quit to end the shell session. + +my-cluster(mycluster)> +``` + + +# Non interactive mode Review Comment: Can it be renamed to sth. like "Run admin commands sequentially" to make it clear what's the purpose? Because we don't have a section named "Interactive mode", this heading can be confused. ########## site2/docs/administration-pulsar-shell.md: ########## @@ -0,0 +1,174 @@ +--- +id: administration-pulsar-shell +title: Pulsar Shell +sidebar_label: "Pulsar Shell" +--- + +````mdx-code-block +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +```` + + +Pulsar shell is a fast and flexible shell for Pulsar cluster management, messaging, and more. +It's great for quickly switching between different clusters, and can modify cluster or tenant configurations in an instant. + + +# Features +- Administration: find all the [Admin API](admin-api-overview.md) features under the `admin` command . +- Client: find all the [pulsar-client](reference-cli-tools#pulsar-client.md) features under the `client` command. + + +# Installation + +Download the tarball from the [download page](https://pulsar.apache.org/download) and extract it. + +```shell +wget https://archive.apache.org/dist/pulsar/pulsar-@pulsar:version@/apache-pulsar-shell-@pulsar:[email protected] +tar xzvf apache-pulsar-shell-@pulsar:[email protected] +cd apache-pulsar-shell-@pulsar:[email protected] +``` + +Now you can enter Pulsar shell's interactive mode: + +```shell +$ ./bin/pulsar-shell +Welcome to Pulsar shell! + Service URL: pulsar://localhost:6650/ + Admin URL: http://localhost:8080/ + +Type help to get started or try the autocompletion (TAB button). +Type exit or quit to end the shell session. + +default(localhost)> +``` + + +# Connect to your cluster + +By default, the shell will try to connect to a local Pulsar instance. +To connect to a different cluster, you have to register the cluster with Pulsar shell. You can do this in a few different ways depending on where your config file is located: + +> The configuration file must be a valid `client.conf` file, the same one you use for `pulsar-admin`, `pulsar-client` and other client tools. + +````mdx-code-block +<Tabs groupId="shell-config-modes" + defaultValue="url" + values={[{"label":"Remote URL","value":"url"},{"label":"File","value":"file"},{"label":"Inline","value":"inline"}]}> +<TabItem value="url"> + + +The `--url` value must point to a valid remote file. + + +``` +default(localhost)> config create --url https://<url_to_my_client.conf> mycluster +``` + +</TabItem> +<TabItem value="file"> + +If the file is on your local machine, use the `--file` option. + + +``` +default(localhost)> config create --file ./my-cluster-my-client.conf mycluster +``` + +</TabItem> +<TabItem value="inline"> + +You can encode the content of the config to base64 and specify it with the `--value` option. + +``` +default(localhost)> config create --value "base64:<client.conf_base64_encoded>" mycluster +``` + + +</TabItem> + +</Tabs> +```` + + +Once you've configured your cluster, set it as current: + +``` +default(localhost)> config use mycluster +Welcome to Pulsar shell! + Service URL: pulsar+ssl://mycluster:6651/ + Admin URL: https://mycluster:8443/ + +Type help to get started or try the autocompletion (TAB button). +Type exit or quit to end the shell session. + +my-cluster(mycluster)> +``` + + +# Non interactive mode +Pulsar shell's non-interactive mode is great for running bunch of admin commands sequentially. Review Comment: ```suggestion To run a bunch of admin commands sequentially, you can use Pulsar shell's non-interactive mode. ``` -- 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]
