Difference between revisions of "Kafka"
From John Freier
(Created page with " == Run Kafka in Docker ==") |
|||
Line 1: | Line 1: | ||
− | == Run Kafka in | + | == Run Kafka in Podman == |
+ | The following will run Kafka and Zookeeper in Podman, and allow you to connect to localhost:9092. | ||
+ | |||
+ | |||
+ | Pull the Zookeeper and Kafka images. | ||
+ | |||
+ | podman pull bitnami/kafka | ||
+ | podman pull bitnami/zookeeper | ||
+ | |||
+ | Create a pod container to place the containers in so they can talk to each other. | ||
+ | |||
+ | podman pod create \ | ||
+ | --name kafka-pod \ | ||
+ | -p 9092:9092 \ | ||
+ | -p 2181:2181 | ||
+ | |||
+ | Start the Zookeeper instance. | ||
+ | |||
+ | podman run \ | ||
+ | -d \ | ||
+ | --pod kafka-pod \ | ||
+ | --name zookeeper \ | ||
+ | -e ALLOW_ANONYMOUS_LOGIN=yes \ | ||
+ | bitnami/zookeeper | ||
+ | |||
+ | Start the Kafka instance. | ||
+ | |||
+ | podman run \ | ||
+ | -d \ | ||
+ | --pod kafka-pod \ | ||
+ | --name kafka \ | ||
+ | -e ALLOW_PLAINTEXT_LISTENER=yes \ | ||
+ | -e KAFKA_CFG_ZOOKEEPER_CONNECT=127.0.0.1:2181 \ | ||
+ | -e KAFKA_CFG_LISTENERS=PLAINTEXT://:9092 \ | ||
+ | -e KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 \ | ||
+ | bitnami/kafka |
Latest revision as of 08:28, 29 August 2022
Run Kafka in Podman
The following will run Kafka and Zookeeper in Podman, and allow you to connect to localhost:9092.
Pull the Zookeeper and Kafka images.
podman pull bitnami/kafka podman pull bitnami/zookeeper
Create a pod container to place the containers in so they can talk to each other.
podman pod create \ --name kafka-pod \ -p 9092:9092 \ -p 2181:2181
Start the Zookeeper instance.
podman run \ -d \ --pod kafka-pod \ --name zookeeper \ -e ALLOW_ANONYMOUS_LOGIN=yes \ bitnami/zookeeper
Start the Kafka instance.
podman run \ -d \ --pod kafka-pod \ --name kafka \ -e ALLOW_PLAINTEXT_LISTENER=yes \ -e KAFKA_CFG_ZOOKEEPER_CONNECT=127.0.0.1:2181 \ -e KAFKA_CFG_LISTENERS=PLAINTEXT://:9092 \ -e KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 \ bitnami/kafka