-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
第三期 作业四:部署 Apache Kafka 多实例集群 #25
Comments
本地docker version: "3"
networks:
app-kafka:
driver: host
services:
zookeeper:
image: 'bitnami/zookeeper:latest'
networks:
- app-kafka
ports:
- '2181:2181'
environment:
# 匿名登录--必须开启
- ALLOW_ANONYMOUS_LOGIN=yes
volumes:
- /Volumes/PortableSSD/docker/zookeeper:/bitnami/zookeeper
kafka1:
image: 'bitnami/kafka:2.8.0'
networks:
- app-kafka
ports:
- '9092:9092'
environment:
- KAFKA_BROKER_ID=1
- KAFKA_CFG_LISTENERS=INTERNAL://kafka1:9092
- KAFKA_CFG_ADVERTISED_LISTENERS=INTERNAL://192.168.1.149:9092
- KAFKA_CFG_ADVERTISED_HOST_NAME=kafka1
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
# 允许使用PLAINTEXT协议(镜像中默认为关闭,需要手动开启)
- ALLOW_PLAINTEXT_LISTENER=yes
# 关闭自动创建 topic 功能
- KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=false
# 全局消息过期时间 6 小时(测试时可以设置短一点)
- KAFKA_CFG_LOG_RETENTION_HOURS=6
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
- KAFKA_CFG_INTER_BROKER_LISTENER_NAME=INTERNAL
# 开启JMX监控
volumes:
- /Volumes/PortableSSD/docker/kafka1:/bitnami/kafka
depends_on:
- zookeeper
kafka2:
image: 'bitnami/kafka:2.8.0'
networks:
- app-kafka
ports:
- '9093:9092'
environment:
- KAFKA_BROKER_ID=2
- KAFKA_CFG_LISTENERS=INTERNAL://kafka2:9093
# 客户端访问地址,更换成自己的
- KAFKA_CFG_ADVERTISED_LISTENERS=INTERNAL://192.168.1.149:9093
- KAFKA_CFG_ADVERTISED_HOST_NAME=kafka2
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
# 允许使用PLAINTEXT协议(镜像中默认为关闭,需要手动开启)
- ALLOW_PLAINTEXT_LISTENER=yes
# 关闭自动创建 topic 功能
- KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=false
# 全局消息过期时间 6 小时(测试时可以设置短一点)
- KAFKA_CFG_LOG_RETENTION_HOURS=6
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
- KAFKA_CFG_INTER_BROKER_LISTENER_NAME=INTERNAL
# 开启JMX监控
volumes:
- /Volumes/PortableSSD/docker/kafka2:/bitnami/kafka
depends_on:
- zookeeper
kafka3:
image: 'bitnami/kafka:2.8.0'
networks:
- app-kafka
ports:
- '9094:9092'
environment:
- KAFKA_BROKER_ID=3
- KAFKA_CFG_LISTENERS=INTERNAL://kafka3:9094
# 客户端访问地址,更换成自己的
- KAFKA_CFG_ADVERTISED_LISTENERS=INTERNAL://192.168.1.149:9094
- KAFKA_CFG_ADVERTISED_HOST_NAME=kafka3
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
# 允许使用PLAINTEXT协议(镜像中默认为关闭,需要手动开启)
- ALLOW_PLAINTEXT_LISTENER=yes
# 关闭自动创建 topic 功能
- KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=false
# 全局消息过期时间 6 小时(测试时可以设置短一点)
- KAFKA_CFG_LOG_RETENTION_HOURS=6
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
- KAFKA_CFG_INTER_BROKER_LISTENER_NAME=INTERNAL
# 开启JMX监控
volumes:
- /Volumes/PortableSSD/docker/kafka3:/bitnami/kafka
depends_on:
- zookeeper
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
要求
The text was updated successfully, but these errors were encountered: