forked from streamnative/kop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-cluster.yaml
126 lines (122 loc) · 4.28 KB
/
docker-compose-cluster.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
version: '3'
networks:
pulsar:
driver: bridge
services:
# Start zookeeper
zookeeper:
image: streamnative/sn-pulsar:2.11.1.0
container_name: zookeeper
restart: "no"
networks:
- pulsar
volumes:
- ./data/zookeeper:/pulsar/data/zookeeper
environment:
- metadataStoreUrl=zk:zookeeper:2181
- PULSAR_MEM=-Xms256m -Xmx256m -XX:MaxDirectMemorySize=256m
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
ports:
- "2181:2181"
# Init cluster metadata
pulsar-init:
container_name: pulsar-init
hostname: pulsar-init
image: streamnative/sn-pulsar:2.11.1.0
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: streamnative/sn-pulsar:2.11.1.0
container_name: bookie
restart: "no"
networks:
- pulsar
environment:
- clusterName=cluster-a
- zkServers=zookeeper:2181
- metadataServiceUri=metadata-store:zk:zookeeper:2181
# otherwise every time we run docker compose uo or down we fail to start due to Cookie
- advertisedAddress=bookie
- BOOKIE_MEM=-Xms512m -Xmx512m -XX:MaxDirectMemorySize=256m
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: streamnative/sn-pulsar:2.11.1.0
container_name: broker
hostname: broker
restart: "no"
networks:
- pulsar
environment:
- PULSAR_MEM=-Xms512m -Xmx512m -XX:MaxDirectMemorySize=256m
- PULSAR_PREFIX_metadataStoreUrl=zk:zookeeper:2181
- PULSAR_PREFIX_zookeeperServers=zookeeper:2181
- PULSAR_PREFIX_clusterName=cluster-a
- PULSAR_PREFIX_managedLedgerDefaultEnsembleSize=1
- PULSAR_PREFIX_managedLedgerDefaultWriteQuorum=1
- PULSAR_PREFIX_managedLedgerDefaultAckQuorum=1
- PULSAR_PREFIX_advertisedAddress=broker
- PULSAR_PREFIX_advertisedListeners=external:pulsar://127.0.0.1:6650
# KoP
- PULSAR_PREFIX_messagingProtocols=kafka
- PULSAR_PREFIX_allowAutoTopicCreationType=partitioned
- PULSAR_PREFIX_kafkaListeners=PLAINTEXT://0.0.0.0:9092
- PULSAR_PREFIX_kafkaAdvertisedListeners=PLAINTEXT://127.0.0.1:9092
- PULSAR_PREFIX_brokerEntryMetadataInterceptors=org.apache.pulsar.common.intercept.AppendIndexMetadataInterceptor
- PULSAR_PREFIX_brokerDeleteInactiveTopicsEnabled=false
- PULSAR_PREFIX_kopSchemaRegistryEnable=true
- PULSAR_PREFIX_kopSchemaRegistryPort=8081
- PULSAR_PREFIX_kafkaTransactionCoordinatorEnabled=true
depends_on:
zookeeper:
condition: service_healthy
bookie:
condition: service_started
ports:
- "6650:6650"
- "8080:8080"
#- "8001:8001" # what is this for?
- "9092:9092"
- "8081:8081"
command: bash -c "bin/apply-config-from-env.py conf/broker.conf && exec bin/pulsar broker"