You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/09/30 10:49:24 UTC

[GitHub] [pulsar] liangyepianzhou commented on a diff in pull request #17853: [fxi][doc] Rewrite the steps of docker-deploy

liangyepianzhou commented on code in PR #17853:
URL: https://github.com/apache/pulsar/pull/17853#discussion_r984466128


##########
site2/docs/deploy-docker.md:
##########
@@ -3,50 +3,97 @@ id: deploy-docker
 title: Deploy a cluster on Docker
 sidebar_label: "Docker"
 ---
-
-To deploy a Pulsar cluster on Docker, complete the following steps:
-1. Deploy a ZooKeeper cluster (optional)
-2. Initialize cluster metadata
-3. Deploy a BookKeeper cluster
-4. Deploy one or more Pulsar brokers
+## Deploy a cluster on Docker
+To deploy a Pulsar cluster on Docker, you need to complete the next steps:
+1. pull the pulsar docker image
+2. create the zookeeper, bookie, broker container by the image
+3. create a network, and make the container connects to it.
+4. start the zookeeper, and then init the cluster metadata
+5. start the broker and bookie
 
 ## Prepare
+To run Pulsar on Docker, you need to create a container for each Pulsar component: ZooKeeper, BookKeeper and broker. You can pull the images of ZooKeeper and BookKeeper separately on Docker Hub, and pull a Pulsar image for the broker. You can also pull only one Pulsar image and create three containers with this image. This tutorial takes the second option as an example.
 
-To run Pulsar on Docker, you need to create a container for each Pulsar component: ZooKeeper, BookKeeper and broker. You can pull the images of ZooKeeper and BookKeeper separately on [Docker Hub](https://hub.docker.com/), and pull a [Pulsar image](https://hub.docker.com/r/apachepulsar/pulsar-all/tags) for the broker. You can also pull only one [Pulsar image](https://hub.docker.com/r/apachepulsar/pulsar-all/tags) and create three containers with this image. This tutorial takes the second option as an example.
-
-### Pull a Pulsar image
-You can pull a Pulsar image from [Docker Hub](https://hub.docker.com/r/apachepulsar/pulsar-all/tags) with the following command.
+## Pull a Pulsar image
+You can pull a Pulsar image from Docker Hub with the following command. If you want to use some connectors, you can use apachepulsar/pulsar-all there.
 
-```shell
+```java
 docker pull apachepulsar/pulsar-all:latest
 ```
+## Create containers
+* Create zookeeper container
+
+```
+docker run -d --privileged=true -u=root -e PULSAR_PREFIX_metadataStoreUrl=zk:zookeeper:2181 -e PULSAR_PREFIX_cluster-name=cluster-a -e PULSAR_PREFIX_managedLedgerDefaultEnsembleSize=1 -e PULSAR_PREFIX_managedLedgerDefaultWriteQuorum=1 -e PULSAR_PREFIX_managedLedgerDefaultAckQuorum=1 --name zookeeper apachepulsar/pulsar-all:latest /bin/bash
+```
 
-### Create three containers
-Create containers for ZooKeeper, BookKeeper and broker. In this example, they are named as `zookeeper`, `bookkeeper` and `broker` respectively. You can name them as you want with the `--name` flag. By default, the container names are created randomly.
+* Create broker container
 
-```shell
-docker run -it --name bookkeeper apachepulsar/pulsar-all:latest /bin/bash
-docker run -it --name zookeeper apachepulsar/pulsar-all:latest /bin/bash
-docker run -it --name broker apachepulsar/pulsar-all:latest /bin/bash
+```
+docker run -d --privileged=true -u=root -e PULSAR_PREFIX_metadataStoreUrl=zk:zookeeper:2181 -e PULSAR_PREFIX_cluster-name=cluster-a -e PULSAR_PREFIX_managedLedgerDefaultEnsembleSize=1 -e PULSAR_PREFIX_managedLedgerDefaultWriteQuorum=1 -e PULSAR_PREFIX_managedLedgerDefaultAckQuorum=1 --name broker apachepulsar/pulsar-all:latest /bin/bash
 ```
 
-### Create a network
-To deploy a Pulsar cluster on Docker, you need to create a `network` and connect the containers of ZooKeeper, BookKeeper and broker to this network. The following command creates the network `pulsar`:
+* Create bookie container
 
-```shell
+```
+docker run -d --privileged=true -u=root -e PULSAR_PREFIX_zkServers=zookeeper:2181 -e PULSAR_PREFIX_metadataServiceUri=metadata-store:zk:zookeeper:2181  --name bookie apachepulsar/pulsar-all:latest /bin/bash
+```
+## Create the network
+To deploy a Pulsar cluster on Docker, you need to create a network and connect the containers of ZooKeeper, BookKeeper and broker to this network. The following command creates the network pulsar:
+```
 docker network create pulsar
 ```
+Connect the containers of ZooKeeper, BookKeeper and broker to the pulsar network with the following commands.
 
-### Connect containers to network
-Connect the containers of ZooKeeper, BookKeeper and broker to the `pulsar` network with the following commands. 
-
-```shell
+```
 docker network connect pulsar zookeeper
+```
+```
 docker network connect pulsar bookkeeper
+```
+```
 docker network connect pulsar broker
+```
 
+## start the zookeeper, and init the cluster metadata
+Start the zookeeper service in the docker container by the following commands:
+1. Open the zookeeper container
+```
+docker exec -it zookeeper bash
+```
+2. Start the zookeeper service
+```
+bin/pulsar-daemon start zookeeper
+```
+3. init the cluster metadata
+```
+ bin/pulsar initialize-cluster-metadata \
+          --cluster cluster-a \
+          --zookeeper zookeeper:2181 \
+          --configuration-store zookeeper:2181 \
+          --web-service-url http://broker:8080 \
+          --broker-service-url pulsar://broker:6650 \
+```
+## start the broker and bookie service
+Start the broker and bookie service in the docker container by the following commands:
+### Start broker service
+1. Open the broker container
+```
+docker exec -it broker bash
+```
+2. Start the broker service
+```
+bin/pulsar-daemon start broker
+```
+
+### Start bookie service
+1. Open the bookie container
+```
+docker exec -it bookie bash
+```
+2. Start the bookie service
+```
+bin/pulsar-daemon start bookie

Review Comment:
   This is a deployment instead of ` get start`, right?
   But I think we can export the ports.
   And you can comment on the google doc.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org