Reputation: 27
I've set up a basic three-server cluster of zookeeper and kafka version 5.4.0 using docker. For zookeeper and kafka, I've specified all three of the bootstrap servers. I'm trying to set this up in a manner that allows for one server to go down and the cluster will still operate correctly. I'm trying to get control center working and I'm running into problems. First, it seems as though only one of the servers is successfully able to run control center, and only when i specify the bootstrap server it's running on rather than all three. If I try to start control center on the other two servers, they fail to start and they continually log the following:
INFO unable to get command store (io.confluent.command.CommandStore)
I'm not certain how best to get this done. Since it may be helpful, I'm posting below my docker-compose files for the zookeeper/broker pair as well as the file for control center. Please let me know if I've got anything misspecified or if you think a change is in order.
zookeeper/kafka broker docker-compose.yml (the others differ only by advertised listener IP):
---
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper:5.4.0
hostname: zookeeper
container_name: zookeeper
network_mode: host
restart: always
ports:
- "2181:2181"
environment:
ZOOKEEPER_SERVER_ID: 2
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_SERVERS: "10.100.1.1:2888:3888;10.100.1.2:2888:3888;10.100.1.3:2888:3888"
volumes:
- ./zk-data:/var/lib/zookeeper/data
- ./zk-txn-logs:/var/lib/zookeeper/log
broker:
image: confluentinc/cp-enterprise-kafka:5.4.0
hostname: broker
container_name: broker
depends_on:
- zookeeper
network_mode: host
restart: always
ports:
- "9092:9092"
environment:
KAFKA_BROKER_ID: 2
KAFKA_ZOOKEEPER_CONNECT: '10.100.1.1:2181,10.100.1.2:2181,10.100.1.3:2181'
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://10.100.1.1:9092"
KAFKA_METRIC_REPORTERS: io.confluent.metrics.reporter.ConfluentMetricsReporter
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: 10.100.1.1:9092,10.100.1.2:9092,10.100.1.3:9092
CONFLUENT_METRICS_REPORTER_ZOOKEEPER_CONNECT: 10.100.1.1:2181,10.100.1.2:2181,10.100.1.3:2181
CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 2
CONFLUENT_METRICS_ENABLE: 'true'
CONFLUENT_SUPPORT_CUSTOMER_ID: 'anonymous'
volumes:
- ./kafka-data:/var/lib/kafka/data
control center docker-compose.yml:
---
version: '2'
services:
control-center:
image: confluentinc/cp-enterprise-control-center:5.4.0
hostname: control-center
container_name: control-center
network_mode: host
restart: always
ports:
- "9021:9021"
environment:
CONTROL_CENTER_BOOTSTRAP_SERVERS: '10.100.1.1:9092'
CONTROL_CENTER_ZOOKEEPER_CONNECT: '10.100.1.1:2181'
CONTROL_CENTER_REPLICATION_FACTOR: 1
CONTROL_CENTER_INTERNAL_TOPICS_PARTITIONS: 1
CONTROL_CENTER_MONITORING_INTERCEPTOR_TOPIC_PARTITIONS: 1
CONFLUENT_METRICS_TOPIC_REPLICATION: 1
PORT: 9021
volumes:
- ./control-center:/var/lib/confluent-control-center
Upvotes: 1
Views: 2299
Reputation: 191738
1) remove network_mode: host
2l Add control center to the same compose file
3) use zookeeper:2181
for the Zookeeper connection strings and kafka:9092
for the bootstrap servers. I don't think metrics reporters or control center have a Zookeeper property
If you want to create a cluster of containers, then you probably want to take a look at the Confluent Helm Charts rather than the Docker compose files
Upvotes: 2