浏览代码

Fix cluster-only docker config (#99)

* Fix cluster-only docker config

* CI test

* CI test

* CI test

* Add replica back
Anton Petrov 4 年之前
父节点
当前提交
dce98a06a8
共有 2 个文件被更改,包括 39 次插入11 次删除
  1. 33 5
      docker/kafka-clusters-only.yaml
  2. 6 6
      kafka-ui-api/src/main/resources/application-local.yml

+ 33 - 5
docker/kafka-clusters-only.yaml

@@ -7,6 +7,8 @@ services:
     environment:
       ZOOKEEPER_CLIENT_PORT: 2181
       ZOOKEEPER_TICK_TIME: 2000
+    ports:
+    - 2181:2181
 
   kafka0:
     image: confluentinc/cp-kafka:5.1.0
@@ -18,15 +20,37 @@ services:
       KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka0:29092,PLAINTEXT_HOST://localhost:9092
       KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
       KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
-      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
+      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
       JMX_PORT: 9997
-      KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=kafka0 -Dcom.sun.management.jmxremote.rmi.port=9997
+      KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.rmi.port=9997
+    ports:
+      - 9092:9092
+      - 9997:9997
+
+  kafka01:
+    image: confluentinc/cp-kafka:5.1.0
+    depends_on:
+      - zookeeper0
+    environment:
+      KAFKA_BROKER_ID: 2
+      KAFKA_ZOOKEEPER_CONNECT: zookeeper0:2181
+      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka01:29092,PLAINTEXT_HOST://localhost:9094
+      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT,PLAIN:PLAINTEXT
+      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
+      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
+      JMX_PORT: 9999
+      KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.rmi.port=9999
+    ports:
+      - 9094:9094
+      - 9999:9999
 
   zookeeper1:
     image: confluentinc/cp-zookeeper:5.1.0
     environment:
       ZOOKEEPER_CLIENT_PORT: 2181
       ZOOKEEPER_TICK_TIME: 2000
+    ports:
+      - 2182:2181
 
   kafka1:
     image: confluentinc/cp-kafka:5.1.0
@@ -39,16 +63,20 @@ services:
       KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
       KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
       KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
-      JMX_PORT: 9997
-      KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=kafka1 -Dcom.sun.management.jmxremote.rmi.port=9997
+      JMX_PORT: 9998
+      KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.rmi.port=9998
+    ports:
+      - 9093:9093
+      - 9998:9998 
 
   schemaregistry0:
     image: confluentinc/cp-schema-registry:5.1.0
     depends_on:
       - zookeeper0
       - kafka0
+      - kafka01
     environment:
-      SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka0:29092
+      SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka0:29092,PLAINTEXT://kafka01:29092
       SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: zookeeper0:2181
       SCHEMA_REGISTRY_KAFKASTORE_SECURITY_PROTOCOL: PLAINTEXT
       SCHEMA_REGISTRY_HOST_NAME: schemaregistry0

+ 6 - 6
kafka-ui-api/src/main/resources/application-local.yml

@@ -2,21 +2,21 @@ kafka:
   clusters:
     -
       name: local
-      bootstrapServers: localhost:29091
-      zookeeper: localhost:2183
+      bootstrapServers: localhost:9092
+      zookeeper: localhost:2181
       schemaRegistry: http://localhost:8085
 #      schemaNameTemplate: "%s-value"
       jmxPort: 9997
     -
       name: secondLocal
-      bootstrapServers: localhost:29092
+      bootstrapServers: localhost:9093
       zookeeper: localhost:2182
       jmxPort: 9998
     -
       name: localReplica
-      bootstrapServers: localhost:29093
-      zookeeper: localhost:2183
-      jmxPort: 9997
+      bootstrapServers: localhost:9094
+      zookeeper: localhost:2181
+      jmxPort: 9999
   admin-client-timeout: 5000
 zookeeper:
   connection-timeout: 1000