[英]Run provectus/kafka-ui for a Kafka cluster on a different Server
I'm in a bit of trouble trying to run provectus/kafka-ui docker containers.我在尝试运行 provectus/kafka-ui docker 容器时遇到了一些麻烦。 I have a collection of servers all running on the same internal.network.
我有一组服务器都在同一个 internal.network 上运行。 On three of these servers a Kafka cluster is implemented (Zookeeper and Broker).
在其中三台服务器上实现了 Kafka 集群(Zookeeper 和 Broker)。 The structure of the Broker looks like the following:
Broker 的结构如下所示:
192.168.0.237:9092
192.168.0.7:9092
192.168.0.54:9092
The problem is that there is no Docker instance running on any of these servers.问题是没有 Docker 实例在这些服务器上运行。 What I would like to achieve now is to install provectus/kafka-ui on another server (192.168.0.8) and make it accessible from within the.network via a specific port (eg 8080).
我现在想要实现的是在另一台服务器(192.168.0.8)上安装 provectus/kafka-ui 并使其可以通过特定端口(例如 8080)从 .network 内部访问。
I have found a few docker-compose.yml examples https://github.com/provectus/kafka-ui .我找到了一些 docker-compose.yml 示例https://github.com/provectus/kafka-ui 。 However, the Kafka cluster is created on the same server as kafka-ui.
但是,Kafka 集群是在与 kafka-ui 相同的服务器上创建的。 In my case, the cluster already exists and only kafka-ui is missing on another server.
在我的例子中,集群已经存在,并且在另一台服务器上只缺少 kafka-ui。 Can anyone tell me how I can adapt the docker-compose.yml so that kafka-ui can be installed on 192.168.0.8 and made available from outside via port 8080?
谁能告诉我如何调整 docker-compose.yml 以便 kafka-ui 可以安装在 192.168.0.8 上并通过端口 8080 从外部访问?
Kind regards and thanks in advance亲切的问候和提前致谢
version: '3'
services:
kafka-ui:
container_name: kafka-ui
image: provectuslabs/kafka-ui:latest
ports:
- 8080:8080
depends_on:
- zookeeper
- kafka1
environment:
KAFKA_CLUSTERS_0_NAME: local
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka1:19091
KAFKA_CLUSTERS_0_ZOOKEEPER: zookeeper:2181
KAFKA_CLUSTERS_0_JMXPORT: 9997
SERVER_SERVLET_CONTEXT_PATH: /kafkaui
AUTH_TYPE: "LOGIN_FORM"
SPRING_SECURITY_USER_NAME: test_user
SPRING_SECURITY_USER_PASSWORD: test
zookeeper:
image: confluentinc/cp-zookeeper:5.2.4
hostname: zookeeper
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
volumes:
- ./data/zookeeper/data:/data
- ./data/zookeeper/datalog:/datalog
kafka1:
image: confluentinc/cp-kafka:5.3.1
hostname: kafka1
ports:
- "9091:9091"
environment:
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka1:19091,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9091
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
KAFKA_BROKER_ID: 1
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "False"
volumes:
- ./data/kafka1/data:/var/lib/kafka/data
depends_on:
- zookeeper
kafka2:
image: confluentinc/cp-kafka:5.3.1
hostname: kafka2
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka2:19092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_BROKER_ID: 2
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "False"
volumes:
- ./data/kafka2/data:/var/lib/kafka/data
depends_on:
- zookeeper
kafka3:
image: confluentinc/cp-kafka:5.3.1
hostname: kafka3
ports:
- "9093:9093"
environment:
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka3:19093,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9093
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
KAFKA_BROKER_ID: 3
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "False"
volumes:
- ./data/kafka3/data:/var/lib/kafka/data
depends_on:
- zookeeper
kafdrop:
image: obsidiandynamics/kafdrop
restart: "no"
ports:
- "9000:9000"
environment:
KAFKA_BROKERCONNECT: "kafka1:19091"
depends_on:
- kafka1
- kafka2
- kafka3
You don't need Docker on the Kafka brokers... Also, IP doesn't really matter as long as advertised.listeners
on Kafka is setup correctly.您不需要 Docker 在 Kafka 经纪人上......此外,只要正确设置了 Kafka 上的
advertised.listeners
,IP 并不重要。
Remove the three Kafka containers, the Zookeeper container, and simply change these to your actual Kafka brokers + Zookeeper servers删除三个 Kafka 容器,Zookeeper 容器,并将它们简单地更改为您实际的 Kafka 代理 + Zookeeper 服务器
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS
KAFKA_CLUSTERS_0_ZOOKEEPER
Also remove kafdrop?还删除kafdrop? Since it's basically another UI with overlapping features.
因为它基本上是另一个具有重叠功能的 UI。
Or, install pnpm and Java, and you can run the UI + API without Docker , just like you're doing with Kafka.或者,安装 pnpm 和 Java,您可以在没有 Docker 的情况下运行 UI + API ,就像您在使用 Kafka 时一样。
https://github.com/provectus/kafka-ui/tree/master/kafka-ui-react-app https://github.com/provectus/kafka-ui/tree/master/kafka-ui-react-app
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.