1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2025-01-02 03:37:40 +02:00

update kafka

This commit is contained in:
kev 2021-11-26 14:58:00 +08:00
parent 4961cd416d
commit 8a0b8f9cf5
7 changed files with 142 additions and 129 deletions

View File

@ -3,7 +3,7 @@ version: "3.8"
services: services:
zookeeper: zookeeper:
image: zookeeper image: zookeeper:3.7
ports: ports:
- "2181:2181" - "2181:2181"
volumes: volumes:
@ -12,14 +12,14 @@ services:
restart: unless-stopped restart: unless-stopped
kafka: kafka:
image: wurstmeister/kafka image: wurstmeister/kafka:2.12-2.5.0
ports: ports:
- "9092:9092" - "9092:9092"
volumes: volumes:
- ./data/kafka:/kafka - ./data/kafka:/kafka
- /var/run/docker.sock:/var/run/docker.sock
environment: environment:
- KAFKA_ADVERTISED_HOST_NAME=10.0.0.13 - KAFKA_ADVERTISED_HOST_NAME=10.0.0.13
- KAFKA_ADVERTISED_PORT=9092
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 - KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
- JMX_PORT=9999 - JMX_PORT=9999
depends_on: depends_on:

View File

@ -1,17 +1,19 @@
kafka-manager: version: "3.8"
image: vimagick/kafka-manager services:
ports: cmak:
- "9000:9000" image: vimagick/cmak
environment: ports:
- ZK_HOSTS=zookeeper1:2181,zookeeper2:2181,zookeeper3:2181 - "9000:9000"
- KAFKA_MANAGER_AUTH_ENABLED=true environment:
- KAFKA_MANAGER_USERNAME=admin - ZK_HOSTS=zookeeper1:2181,zookeeper2:2181,zookeeper3:2181
- KAFKA_MANAGER_PASSWORD=admin - KAFKA_MANAGER_AUTH_ENABLED=true
extra_hosts: - KAFKA_MANAGER_USERNAME=admin
- zookeeper1:10.0.0.21 - KAFKA_MANAGER_PASSWORD=admin
- zookeeper2:10.0.0.22 extra_hosts:
- zookeeper3:10.0.0.23 - zookeeper1:10.0.0.21
- kafka1:10.0.0.21 - zookeeper2:10.0.0.22
- kafka2:10.0.0.22 - zookeeper3:10.0.0.23
- kafka3:10.0.0.23 - kafka1:10.0.0.21
restart: always - kafka2:10.0.0.22
- kafka3:10.0.0.23
restart: unless-stopped

View File

@ -1,27 +1,28 @@
kafka: version: "3.8"
image: wurstmeister/kafka:2.12-2.4.0 services:
ports: kafka:
- "9092:9092" image: wurstmeister/kafka:2.12-2.5.0
- "9999:9999" ports:
hostname: kafka1 - "9092:9092"
volumes: - "9999:9999"
- /data/kafka:/kafka hostname: kafka1
- /var/run/docker.sock:/var/run/docker.sock volumes:
environment: - /data/kafka:/kafka
- KAFKA_BROKER_ID=1 environment:
- KAFKA_LISTENERS=PLAINTEXT://:9092 - KAFKA_BROKER_ID=1
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka1:9092 - KAFKA_LISTENERS=PLAINTEXT://:9092
- KAFKA_ZOOKEEPER_CONNECT=zookeeper1:2181,zookeeper2:2181,zookeeper3:2181 - KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka1:9092
- KAFKA_JMX_OPTS=-Dcom.sun.management.jmxremote - KAFKA_ZOOKEEPER_CONNECT=zookeeper1:2181,zookeeper2:2181,zookeeper3:2181
-Dcom.sun.management.jmxremote.authenticate=false - KAFKA_JMX_OPTS=-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.rmi.port=9999 -Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.rmi.port=9999
extra_hosts: -Dcom.sun.management.jmxremote.port=9999
- zookeeper1:10.0.0.21 extra_hosts:
- zookeeper2:10.0.0.22 - zookeeper1:10.0.0.21
- zookeeper3:10.0.0.23 - zookeeper2:10.0.0.22
- kafka1:10.0.0.21 - zookeeper3:10.0.0.23
- kafka2:10.0.0.22 - kafka1:10.0.0.21
- kafka3:10.0.0.23 - kafka2:10.0.0.22
restart: always - kafka3:10.0.0.23
restart: unless-stopped

View File

@ -1,22 +1,24 @@
zookeeper: version: "3.8"
image: zookeeper:3.5.6 services:
ports: zookeeper:
- "2181:2181" image: zookeeper:3.7
- "2888:2888" ports:
- "3888:3888" - "2181:2181"
hostname: zookeeper1 - "2888:2888"
volumes: - "3888:3888"
- /data/zookeeper/data:/data hostname: zookeeper1
- /data/zookeeper/datalog:/datalog volumes:
- /data/zookeeper/logs:/logs - /data/zookeeper/data:/data
environment: - /data/zookeeper/datalog:/datalog
- ZOO_MY_ID=1 - /data/zookeeper/logs:/logs
- ZOO_SERVERS=quorumListenOnAllIPs=true server.1=zookeeper1:2888:3888;2181 server.2=zookeeper2:2888:3888;2181 server.3=zookeeper3:2888:3888;2181 environment:
- ZOO_LOG4J_PROP=INFO,ROLLINGFILE - ZOO_MY_ID=1
- ZOO_4LW_COMMANDS_WHITELIST=* - ZOO_SERVERS=quorumListenOnAllIPs=true server.1=zookeeper1:2888:3888;2181 server.2=zookeeper2:2888:3888;2181 server.3=zookeeper3:2888:3888;2181
- ZOO_STANDALONE_ENABLED=false - ZOO_LOG4J_PROP=INFO,ROLLINGFILE
extra_hosts: - ZOO_4LW_COMMANDS_WHITELIST=*
- zookeeper1:10.0.0.21 - ZOO_STANDALONE_ENABLED=false
- zookeeper2:10.0.0.22 extra_hosts:
- zookeeper3:10.0.0.23 - zookeeper1:10.0.0.21
restart: always - zookeeper2:10.0.0.22
- zookeeper3:10.0.0.23
restart: unless-stopped

View File

@ -1,38 +1,42 @@
zookeeper: version: "3.8"
image: zookeeper:3.5.6
ports:
- "2181:2181"
volumes:
- ./data/zookeeper/data:/data
- ./data/zookeeper/datalog:/datalog
restart: always
kafka: services:
image: wurstmeister/kafka:2.12-2.4.0
ports:
- "9092:9092"
hostname: kafka
volumes:
- ./data/kafka:/kafka
- /var/run/docker.sock:/var/run/docker.sock
environment:
- KAFKA_ADVERTISED_HOST_NAME=kafka
- KAFKA_ADVERTISED_PORT=9092
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
links:
- zookeeper
restart: always
kafka-manager: zookeeper:
image: vimagick/kafka-manager image: zookeeper:3.7
ports: ports:
- "9000:9000" - "2181:2181"
environment: volumes:
- ZK_HOSTS=zookeeper:2181 - ./data/zookeeper/data:/data
- KAFKA_MANAGER_AUTH_ENABLED=true - ./data/zookeeper/datalog:/datalog
- KAFKA_MANAGER_USERNAME=admin restart: unless-stopped
- KAFKA_MANAGER_PASSWORD=admin
links: kafka:
- zookeeper image: wurstmeister/kafka:2.12-2.5.0
- kafka ports:
restart: always - "9092:9092"
volumes:
- ./data/kafka:/kafka
environment:
- KAFKA_ADVERTISED_HOST_NAME=kafka
- KAFKA_ADVERTISED_PORT=9092
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
- JMX_PORT=9999
depends_on:
- zookeeper
restart: unless-stopped
cmak:
image: vimagick/cmak
ports:
- "9000:9000"
environment:
- ZK_HOSTS=zookeeper:2181
- KAFKA_MANAGER_AUTH_ENABLED=true
- KAFKA_MANAGER_USERNAME=admin
- KAFKA_MANAGER_PASSWORD=admin
depends_on:
- zookeeper
healthcheck:
test: curl -f http://127.0.0.1:9000/api/health || exit 1
restart: unless-stopped

View File

@ -10,18 +10,20 @@ which enables highly reliable distributed coordination.
## docker-compose.yml ## docker-compose.yml
```yaml ```yaml
zookeeper: version: "3.8"
image: zookeeper services:
ports: zookeeper:
- "2181:2181" image: zookeeper
volumes: ports:
- ./data/data:/data - "2181:2181"
- ./data/datalog:/datalog volumes:
- ./data/logs:/logs - ./data/data:/data
environment: - ./data/datalog:/datalog
- ZOO_LOG4J_PROP=INFO,ROLLINGFILE - ./data/logs:/logs
- ZOO_STANDALONE_ENABLED=true environment:
restart: always - ZOO_LOG4J_PROP=INFO,ROLLINGFILE
- ZOO_STANDALONE_ENABLED=true
restart: unless-stopped
``` ```
## Standalone Mode ## Standalone Mode

View File

@ -1,12 +1,14 @@
zookeeper: version: "3.8"
image: zookeeper services:
ports: zookeeper:
- "2181:2181" image: zookeeper
volumes: ports:
- ./data/data:/data - "2181:2181"
- ./data/datalog:/datalog volumes:
- ./data/logs:/logs - ./data/data:/data
environment: - ./data/datalog:/datalog
- ZOO_LOG4J_PROP=INFO,ROLLINGFILE - ./data/logs:/logs
- ZOO_STANDALONE_ENABLED=true environment:
restart: always - ZOO_LOG4J_PROP=INFO,ROLLINGFILE
- ZOO_STANDALONE_ENABLED=true
restart: unless-stopped