Comments (4)
Hi,
I made the following changes in order to support the 0.10.0 version, with advertised_listeners instead of advertised.host/port.
Probably will be useful for someone..
diff --git a/kafka/scripts/start-kafka.sh b/kafka/scripts/start-kafka.sh
index ff37918..1a0b344 100755
--- a/kafka/scripts/start-kafka.sh
+++ b/kafka/scripts/start-kafka.sh
@@ -17,12 +17,17 @@ fi
# Set the external host and port
if [ ! -z "$ADVERTISED_HOST" ]; then
echo "advertised host: $ADVERTISED_HOST"
- sed -r -i "s/#(advertised.host.name)=(.*)/\1=$ADVERTISED_HOST/g" $KAFKA_HOME/config/server.properties
-fi
-if [ ! -z "$ADVERTISED_PORT" ]; then
- echo "advertised port: $ADVERTISED_PORT"
- sed -r -i "s/#(advertised.port)=(.*)/\1=$ADVERTISED_PORT/g" $KAFKA_HOME/config/server.properties
+ #sed -r -i "s/#(advertised.host.name)=(.*)/\1=$ADVERTISED_HOST/g" $KAFKA_HOME/config/server.properties
+ if [ -z "$ADVERTISED_PORT" ]; then
+ sed -r -i "s/#(advertised.listeners)=(PLAINTEXT:\/\/)([^:]*)(:[0-9]*)/\1=\2${ADVERTISED_HOST}\4/g" $KAFKA_HOME/config/server.properties
+ else
+ sed -r -i "s/#(advertised.listeners)=(PLAINTEXT:\/\/)([^:]*)(:[0-9]*)/\1=\2${ADVERTISED_HOST}:${ADVERTISED_PORT}/g" $KAFKA_HOME/config/server.properties
+ fi
fi
+# if [ ! -z "$ADVERTISED_PORT" ]; then
+# echo "advertised port: $ADVERTISED_PORT"
+# sed -r -i "s/#(advertised.port)=(.*)/\1=$ADVERTISED_PORT/g" $KAFKA_HOME/config/server.properties
+# fi
# Set the zookeeper chroot
if [ ! -z "$ZK_CHROOT" ]; then
from docker-kafka.
@jshark I tried adding this to my start-kafka.sh. The sed command works as expected, but the only way I can call kafka from outside of my container is to add advertised.host.name and advertised.port to server.properties. 0.10.0.0 doesn't have it so the original sed command doesn't work either. Is your machine working with your script?
from docker-kafka.
@JonathanAaron if I understand you correctly, you don't specify the environment variable ADVERTISED_HOST/PORT when you start your container. And you should. Here is an example from my docker-compose file:
version: '2'
services:
kafka:
image: 'my_services/kafka:latest'
hostname: kafka.server
environment:
ADVERTISED_HOST: kafka.server
ADVERTISED_PORT: 9092
ports:
- 2181:2181
- 9092:9092
You can also use the CLI option to specify it.
from docker-kafka.
@jshark, your comment from above saved my day! I have a slightly complicated setup with a dedicated docker host and it absolutely did not work without proper use of the hostname
option when I updated from 1.5.x to 3.2.0. I think your example compose file earns a place in the README, I just found this place by coincidence.
from docker-kafka.
Related Issues (20)
- cant build docker image
- THE REPO DOESN'T WORK, USE THIS INSTEAD
- Please archive this repo HOT 2
- Docker image tags based on kafka version HOT 3
- Kafka example not working (with 0.10) HOT 2
- Docker-Kafka to get started with topic and produce and consume HOT 1
- Update to Kafka 0.11 HOT 1
- Has anyone been able to start a topic using Docker Compose? HOT 6
- Using this docker in production HOT 2
- Failed to start kafka 'exit status 127' HOT 6
- using dynamic port allocation on docker host
- Increase max client connections
- Cannot publish
- Can you please drop this repo? HOT 1
- Run kafka with an external volume HOT 1
- Unable to change port mappings HOT 2
- You run Kafka and Zookeeper with root permissions... Intended?
- Update to Kafka 2.0.0 HOT 4
- Docker build no longer works HOT 5
- Where's the volume mount option for docker kafka?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-kafka.