You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by xi...@apache.org on 2023/03/03 10:48:08 UTC

[pulsar-site] branch main updated: [improve][doc] Relocate `docker-compose` content to `Get Started` category (#448)

This is an automated email from the ASF dual-hosted git repository.

xiangying 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 5781760fb92 [improve][doc] Relocate `docker-compose` content to `Get Started` category (#448)
5781760fb92 is described below

commit 5781760fb925c3e3359ae801ae30e75f7b6ea805
Author: Jun Ma <60...@users.noreply.github.com>
AuthorDate: Fri Mar 3 18:48:03 2023 +0800

    [improve][doc] Relocate `docker-compose` content to `Get Started` category (#448)
    
    * Relocate docker-compose to Get Started category
    
    * remove unused files
    
    * Align with the formal wording of Docker Compose
    
    * Align with the formal wording of Docker Compose
    
    * update the cmd and file name
---
 docs/concepts-schema-registry.md                  |   5 -
 docs/deploy-docker.md                             | 144 ++++------------------
 docs/develop-schema.md                            |  62 ----------
 docs/getting-started-concepts-and-architecture.md |  15 ---
 docs/getting-started-docker-compose.md            | 119 ++++++++++++++++++
 docs/getting-started-home.md                      |   2 +-
 sidebars.json                                     |   3 +-
 versioned_docs/version-2.11.x/deploy-docker.md    |  12 +-
 8 files changed, 152 insertions(+), 210 deletions(-)

diff --git a/docs/concepts-schema-registry.md b/docs/concepts-schema-registry.md
deleted file mode 100644
index d28c9e6c301..00000000000
--- a/docs/concepts-schema-registry.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-id: concepts-schema-registry
-title: Schema Registry
-sidebar_label: "Schema Registry"
----
diff --git a/docs/deploy-docker.md b/docs/deploy-docker.md
index 40b82b9f20e..147a4c215d1 100644
--- a/docs/deploy-docker.md
+++ b/docs/deploy-docker.md
@@ -4,29 +4,36 @@ title: Deploy a cluster on Docker
 sidebar_label: "Docker"
 ---
 
-You can use two kinds of methods to deploy a Pulsar cluster on Docker.
-The first uses Docker commands, while the second uses a `docker-compose.yaml` file.
-## Deploy a cluster using Docker commands
-To deploy a Pulsar cluster on Docker, you need to complete the following steps:
+To deploy a Pulsar cluster on Docker using Docker commands, you need to complete the following steps:
 1. Pull a Pulsar Docker image.
 2. Create a network.
 3. Create and start the ZooKeeper, bookie, and broker containers.
-### Pull a Pulsar image
+
+## Pull a Pulsar image
+
 To run Pulsar on Docker, you need to create a container for each Pulsar component: ZooKeeper, bookie, and the broker. You can pull the images of ZooKeeper and bookie separately on Docker Hub, and pull the 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.
+
 You can pull a Pulsar image from Docker Hub with the following command. If you do not want to use some connectors, you can use `apachepulsar/pulsar:latest` there.
+
 ```java
 docker pull apachepulsar/pulsar-all:latest
 ```
-### Create a network
+
+## Create a network
+
 To deploy a Pulsar cluster on Docker, you need to create a network and connect the containers of ZooKeeper, bookie, and broker to this network.
 Use the following command to create the network `pulsar`:
+
 ```bash
 docker network create pulsar
 ```
-### Create and start containers
 
-#### Create a ZooKeeper container
+## Create and start containers
+
+### Create a ZooKeeper container
+
 Create a ZooKeeper container and start the ZooKeeper service.
+
 ```bash
 docker run -d -p 2181:2181 --net=pulsar \
     -e metadataStoreUrl=zk:zookeeper:2181 \
@@ -38,8 +45,11 @@ docker run -d -p 2181:2181 --net=pulsar \
     apachepulsar/pulsar-all:latest \
     bash -c "bin/apply-config-from-env.py conf/zookeeper.conf && bin/generate-zookeeper-config.sh conf/zookeeper.conf && exec bin/pulsar zookeeper"
 ```
-#### Initialize the cluster metadata
+
+### Initialize the cluster metadata
+
 After creating the ZooKeeper container successfully, you can use the following command to initialize the cluster metadata.
+
 ```bash
 docker run --net=pulsar \
     --name initialize-pulsar-cluster-metadata \
@@ -51,8 +61,8 @@ docker run --net=pulsar \
 --broker-service-url pulsar://broker:6650"
 ```
 
+### Create a bookie container
 
-#### Create a bookie container
 Create a bookie container and start the bookie service.
 
 ```bash
@@ -64,117 +74,11 @@ docker run -d -e clusterName=cluster-a \
     apachepulsar/pulsar-all:latest \
     bash -c "bin/apply-config-from-env.py conf/bookkeeper.conf && exec bin/pulsar bookie"
 ```
-#### Create a broker container
-Create a broker container and start the broker service.
-```bash
-docker run -d -p 6650:6650 -p 8080:8080 --net=pulsar  -e metadataStoreUrl=zk:zookeeper:2181  -e zookeeperServers=zookeeper:2181 -e clusterName=cluster-a  -e managedLedgerDefaultEnsembleSize=1 -e managedLedgerDefaultWriteQuorum=1   -e managedLedgerDefaultAckQuorum=1 --name broker --hostname broker apachepulsar/pulsar-all:latest bash -c "bin/apply-config-from-env.py conf/broker.conf && exec bin/pulsar broker"
-```
 
-## Deploy a cluster by using `docker-compose.yaml`
-Use the following template to create a `docker-compose.yaml` file to deploy a Pulsar cluster quickly. And you can modify or add the configurations in the `environment` section.
-
-```yaml
-version: '3'
-networks:
-  pulsar:
-    driver: bridge
-services:
-# Start zookeeper
-  zookeeper:
-    image: apachepulsar/pulsar:latest
-    container_name: zookeeper
-    restart: on-failure
-    networks:
-      - pulsar
-    volumes:
-      - ./data/zookeeper:/pulsar/data/zookeeper
-    environment:
-      - metadataStoreUrl=zk:zookeeper:2181
-    command: >
-      bash -c "bin/apply-config-from-env.py conf/zookeeper.conf && \
-             bin/generate-zookeeper-config.sh conf/zookeeper.conf && \
-             exec bin/pulsar zookeeper"
-    healthcheck:
-      test: ["CMD", "bin/pulsar-zookeeper-ruok.sh"]
-      interval: 10s
-      timeout: 5s
-      retries: 30
-
-# Init cluster metadata
-  pulsar-init:
-    container_name: pulsar-init
-    hostname: pulsar-init
-    image: apachepulsar/pulsar:latest
-    networks:
-      - pulsar
-    command: >
-      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
-    depends_on:
-      zookeeper:
-        condition: service_healthy
-
-# Start bookie
-  bookie:
-    image: apachepulsar/pulsar:latest
-    container_name: bookie
-    restart: on-failure
-    networks:
-      - pulsar
-    environment:
-      - clusterName=cluster-a
-      - zkServers=zookeeper:2181
-      - metadataServiceUri=metadata-store:zk:zookeeper:2181
-    depends_on:
-      zookeeper:
-        condition: service_healthy
-      pulsar-init:
-        condition: service_completed_successfully
-  # Map the local directory to the container to avoid bookie startup failure due to insufficient container disks.
-    volumes:
-      - ./data/bookkeeper:/pulsar/data/bookkeeper
-    command: bash -c "bin/apply-config-from-env.py conf/bookkeeper.conf
-      && exec bin/pulsar bookie"
-
-# Start broker
-  broker:
-    image: apachepulsar/pulsar:latest
-    container_name: broker
-    hostname: broker
-    restart: on-failure
-    networks:
-      - pulsar
-    environment:
-      - metadataStoreUrl=zk:zookeeper:2181
-      - zookeeperServers=zookeeper:2181
-      - clusterName=cluster-a
-      - managedLedgerDefaultEnsembleSize=1
-      - managedLedgerDefaultWriteQuorum=1
-      - managedLedgerDefaultAckQuorum=1
-      - advertisedAddress=broker
-      - advertisedListeners=external:pulsar://127.0.0.1:6650
-    depends_on:
-      zookeeper:
-        condition: service_healthy
-      bookie:
-        condition: service_started
-    ports:
-      - "6650:6650"
-      - "8080:8080"
-    command: bash -c "bin/apply-config-from-env.py conf/broker.conf
-      &&  exec bin/pulsar broker"
-```
+### Create a broker container
 
-To create a Pulsar cluster by using the `docker-compose.yaml` file, run the following command.
-```bash
-docker-compose up -d
-```
+Create a broker container and start the broker service.
 
-If you want to destroy the Pulsar cluster with all the containers, run the following command. It will also delete the network that the containers are connected to.
 ```bash
-docker-compose down
-```
+docker run -d -p 6650:6650 -p 8080:8080 --net=pulsar  -e metadataStoreUrl=zk:zookeeper:2181  -e zookeeperServers=zookeeper:2181 -e clusterName=cluster-a  -e managedLedgerDefaultEnsembleSize=1 -e managedLedgerDefaultWriteQuorum=1   -e managedLedgerDefaultAckQuorum=1 --name broker --hostname broker apachepulsar/pulsar-all:latest bash -c "bin/apply-config-from-env.py conf/broker.conf && exec bin/pulsar broker"
+```
\ No newline at end of file
diff --git a/docs/develop-schema.md b/docs/develop-schema.md
deleted file mode 100644
index 6f43b4c1447..00000000000
--- a/docs/develop-schema.md
+++ /dev/null
@@ -1,62 +0,0 @@
----
-id: develop-schema
-title: Custom schema storage
-sidebar_label: Custom schema storage
-original_id: develop-schema
----
-
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-
-
-By default, Pulsar stores data type [schemas](concepts-schema-registry.md) in [Apache BookKeeper](https://bookkeeper.apache.org) (which is deployed alongside Pulsar). You can, however, use another storage system if you wish. This doc walks you through creating your own schema storage implementation.
-
-To use a non-default (i.e. non-BookKeeper) storage system for Pulsar schemas, you need to implement two Java interfaces: [`SchemaStorage`](#schemastorage-interface) and [`SchemaStorageFactory`](#schemastoragefactory-interface).
-
-## SchemaStorage interface
-
-The `SchemaStorage` interface has the following methods:
-
-```java
-public interface SchemaStorage {
-    // How schemas are updated
-    CompletableFuture<SchemaVersion> put(String key, byte[] value, byte[] hash);
-
-    // How schemas are fetched from storage
-    CompletableFuture<StoredSchema> get(String key, SchemaVersion version);
-
-    // How schemas are deleted
-    CompletableFuture<SchemaVersion> delete(String key);
-
-    // Utility method for converting a schema version byte array to a SchemaVersion object
-    SchemaVersion versionFromBytes(byte[] version);
-
-    // Startup behavior for the schema storage client
-    void start() throws Exception;
-
-    // Shutdown behavior for the schema storage client
-    void close() throws Exception;
-}
-```
-
-> For a full-fledged example schema storage implementation, see the [`BookKeeperSchemaStorage`](https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorage.java) class.
-
-## SchemaStorageFactory interface
-
-```java
-public interface SchemaStorageFactory {
-    @NotNull
-    SchemaStorage create(PulsarService pulsar) throws Exception;
-}
-```
-
-> For a full-fledged example schema storage factory implementation, see the [`BookKeeperSchemaStorageFactory`](https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorageFactory.java) class.
-
-## Deployment
-
-To use your custom schema storage implementation, you need to:
-
-1. Package the implementation in a JAR file.
-2. Add that JAR file to the `lib` folder in your Pulsar distribution.
-3. Change the `schemaRegistryStorageClassName` configuration in [`broker.conf`](reference-configuration.md#broker) to your custom factory class (i.e. the `SchemaStorageFactory` implementation, not the `SchemaStorage` implementation).
-4. Start up Pulsar.
diff --git a/docs/getting-started-concepts-and-architecture.md b/docs/getting-started-concepts-and-architecture.md
deleted file mode 100644
index bc8d3a4ca92..00000000000
--- a/docs/getting-started-concepts-and-architecture.md
+++ /dev/null
@@ -1,15 +0,0 @@
----
-id: concepts-architecture
-title: Pulsar concepts and architecture
-sidebar_label: "Concepts and architecture"
----
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/getting-started-docker-compose.md b/docs/getting-started-docker-compose.md
new file mode 100644
index 00000000000..aa9c3b41967
--- /dev/null
+++ b/docs/getting-started-docker-compose.md
@@ -0,0 +1,119 @@
+---
+id: getting-started-docker-compose
+title: Run a Pulsar cluster locally with Docker Compose
+sidebar_label: "Run Pulsar locally with Docker Compose"
+---
+
+## Configure the `compose.yml` template
+
+To get up and run a Pulsar cluster quickly, you can use the following template to create a `compose.yml` file by modifying or adding the configurations in the **environment** section.
+
+```yaml
+version: '3'
+networks:
+  pulsar:
+    driver: bridge
+services:
+# Start zookeeper
+  zookeeper:
+    image: apachepulsar/pulsar:latest
+    container_name: zookeeper
+    restart: on-failure
+    networks:
+      - pulsar
+    volumes:
+      - ./data/zookeeper:/pulsar/data/zookeeper
+    environment:
+      - metadataStoreUrl=zk:zookeeper:2181
+    command: >
+      bash -c "bin/apply-config-from-env.py conf/zookeeper.conf && \
+             bin/generate-zookeeper-config.sh conf/zookeeper.conf && \
+             exec bin/pulsar zookeeper"
+    healthcheck:
+      test: ["CMD", "bin/pulsar-zookeeper-ruok.sh"]
+      interval: 10s
+      timeout: 5s
+      retries: 30
+
+# Init cluster metadata
+  pulsar-init:
+    container_name: pulsar-init
+    hostname: pulsar-init
+    image: apachepulsar/pulsar:latest
+    networks:
+      - pulsar
+    command: >
+      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
+    depends_on:
+      zookeeper:
+        condition: service_healthy
+
+# Start bookie
+  bookie:
+    image: apachepulsar/pulsar:latest
+    container_name: bookie
+    restart: on-failure
+    networks:
+      - pulsar
+    environment:
+      - clusterName=cluster-a
+      - zkServers=zookeeper:2181
+      - metadataServiceUri=metadata-store:zk:zookeeper:2181
+    depends_on:
+      zookeeper:
+        condition: service_healthy
+      pulsar-init:
+        condition: service_completed_successfully
+  # Map the local directory to the container to avoid bookie startup failure due to insufficient container disks.
+    volumes:
+      - ./data/bookkeeper:/pulsar/data/bookkeeper
+    command: bash -c "bin/apply-config-from-env.py conf/bookkeeper.conf
+      && exec bin/pulsar bookie"
+
+# Start broker
+  broker:
+    image: apachepulsar/pulsar:latest
+    container_name: broker
+    hostname: broker
+    restart: on-failure
+    networks:
+      - pulsar
+    environment:
+      - metadataStoreUrl=zk:zookeeper:2181
+      - zookeeperServers=zookeeper:2181
+      - clusterName=cluster-a
+      - managedLedgerDefaultEnsembleSize=1
+      - managedLedgerDefaultWriteQuorum=1
+      - managedLedgerDefaultAckQuorum=1
+      - advertisedAddress=broker
+      - advertisedListeners=external:pulsar://127.0.0.1:6650
+    depends_on:
+      zookeeper:
+        condition: service_healthy
+      bookie:
+        condition: service_started
+    ports:
+      - "6650:6650"
+      - "8080:8080"
+    command: bash -c "bin/apply-config-from-env.py conf/broker.conf
+      &&  exec bin/pulsar broker"
+```
+
+## Create a Pulsar cluster
+
+To create a Pulsar cluster by using the `compose.yml` file, run the following command.
+
+```bash
+docker compose up -d
+```
+
+If you want to destroy the Pulsar cluster with all the containers, run the following command. It will also delete the network that the containers are connected to.
+
+```bash
+docker compose down
+```
\ No newline at end of file
diff --git a/docs/getting-started-home.md b/docs/getting-started-home.md
index fd6f0d329e5..8cb765ab76a 100644
--- a/docs/getting-started-home.md
+++ b/docs/getting-started-home.md
@@ -8,5 +8,5 @@ Getting up and running with Pulsar is simple. Download it, install it, and try i
 
 You have three options. Click any of these links to begin your Pulsar journey!
 * [Run a standalone Pulsar cluster locally](getting-started-standalone.md) - Run a single instance of Pulsar in standalone mode on a single machine.
-* [Run a standalone Pulsar cluster in Docker](getting-started-docker.md) - Run one or more instances of Pulsar in a Docker container.
+* [Run a standalone Pulsar cluster in Docker](getting-started-docker.md) - Run one or more instances of Pulsar in a Docker container. If you want to quickly set up a small Pulsar cluster on your local laptop, go to [Run a Pulsar cluster with Docker Compose](getting-started-docker-compose.md).
 * [Run a standalone Pulsar cluster in Kubernetes](getting-started-helm.md) - Run one or more instances of Pulsar in Kubernetes using a Helm chart.
diff --git a/sidebars.json b/sidebars.json
index 0a3de50e8d3..fd672fcd72f 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -14,7 +14,8 @@
       "items": [
         "getting-started-standalone",
         "getting-started-docker",
-        "getting-started-helm"
+        "getting-started-helm",
+        "getting-started-docker-compose"
       ]
     },
     {
diff --git a/versioned_docs/version-2.11.x/deploy-docker.md b/versioned_docs/version-2.11.x/deploy-docker.md
index 40b82b9f20e..a1640d30e89 100644
--- a/versioned_docs/version-2.11.x/deploy-docker.md
+++ b/versioned_docs/version-2.11.x/deploy-docker.md
@@ -5,7 +5,7 @@ sidebar_label: "Docker"
 ---
 
 You can use two kinds of methods to deploy a Pulsar cluster on Docker.
-The first uses Docker commands, while the second uses a `docker-compose.yaml` file.
+The first uses Docker commands, while the second uses a `compose.yml` file.
 ## Deploy a cluster using Docker commands
 To deploy a Pulsar cluster on Docker, you need to complete the following steps:
 1. Pull a Pulsar Docker image.
@@ -70,8 +70,8 @@ Create a broker container and start the broker service.
 docker run -d -p 6650:6650 -p 8080:8080 --net=pulsar  -e metadataStoreUrl=zk:zookeeper:2181  -e zookeeperServers=zookeeper:2181 -e clusterName=cluster-a  -e managedLedgerDefaultEnsembleSize=1 -e managedLedgerDefaultWriteQuorum=1   -e managedLedgerDefaultAckQuorum=1 --name broker --hostname broker apachepulsar/pulsar-all:latest bash -c "bin/apply-config-from-env.py conf/broker.conf && exec bin/pulsar broker"
 ```
 
-## Deploy a cluster by using `docker-compose.yaml`
-Use the following template to create a `docker-compose.yaml` file to deploy a Pulsar cluster quickly. And you can modify or add the configurations in the `environment` section.
+## Deploy a cluster by using `compose.yml`
+Use the following template to create a `compose.yml` file to deploy a Pulsar cluster quickly. And you can modify or add the configurations in the `environment` section.
 
 ```yaml
 version: '3'
@@ -169,12 +169,12 @@ services:
       &&  exec bin/pulsar broker"
 ```
 
-To create a Pulsar cluster by using the `docker-compose.yaml` file, run the following command.
+To create a Pulsar cluster by using the `compose.yml` file, run the following command.
 ```bash
-docker-compose up -d
+docker compose up -d
 ```
 
 If you want to destroy the Pulsar cluster with all the containers, run the following command. It will also delete the network that the containers are connected to.
 ```bash
-docker-compose down
+docker compose down
 ```