GithubHelp home page GithubHelp logo

Comments (19)

dustinfarris avatar dustinfarris commented on July 23, 2024 12

@jeven2016 where did that IP address come from? "10.196.10.6"

from kafka-docker.

BenoitPotty avatar BenoitPotty commented on July 23, 2024 3

Hi Guys,

Had the same issue as you, and disabling the Firewall worked fine for me. Did anyone went further on searching which rule we should add to Firewall and be able to leave it active?

Thanks a lot.

from kafka-docker.

sscaling avatar sscaling commented on July 23, 2024 1

Documentation has been added in #291.

Wiki page: https://github.com/wurstmeister/kafka-docker/wiki/Connectivity

from kafka-docker.

vvscher avatar vvscher commented on July 23, 2024 1

I assume it's the issue of the kafka itself.

I've fixed it by:

  1. mapping "kafka" (host name of the kafka inside the docker) to 127.0.0.1 in hosts file (for some reason kafka doesn't always work properly when I call it by the host different from advertised).
  2. and publishing a message to this topic from console producer (to auto create the topic) before the service tries to publish anything.

I cannot call it a decent fix, but it definitely works

from kafka-docker.

yqian1991 avatar yqian1991 commented on July 23, 2024

Hmm, I had the same issue, if you check docker-compose logs, I guess the leader is set to docker-machine ip : 9092, which caused this problem. maybe the problem of docker-compose.yml

from kafka-docker.

geekhuyang avatar geekhuyang commented on July 23, 2024

@yqian1991 Thanks. your meaning is the var KAFKA_ADVERTISED_HOST_NAME in docker-compose should not be the docker host ip?

from kafka-docker.

geekhuyang avatar geekhuyang commented on July 23, 2024

image

image

image

I think the ./broker-list.sh result is no correct,but I have no idea about the reason.

@wurstmeister In this case,I should set the KAFKA_ADVERTISED_HOST_NAME value is which above?
thanks

from kafka-docker.

pluswave avatar pluswave commented on July 23, 2024

same issue on my side. I guess it should be some error with specific combination of host os / docker version / kafka-docker version. So I try to describe this and the reproduce method as detail as possible here.

Host os is Centos 7, Docker version 1.10.3, build 20f81dd, java version 1.8.0 (openjdk), kafka-docker is latest git ( f32ebdc ) . the change is

~ $ git diff docker-compose.yml
diff --git a/docker-compose.yml b/docker-compose.yml
index 73dd854..4f81af8 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -9,6 +9,6 @@ kafka:
   links: 
     - zookeeper:zk
   environment:
-    KAFKA_ADVERTISED_HOST_NAME: 192.168.59.103
+    KAFKA_ADVERTISED_HOST_NAME: 192.168.1.100
   volumes:
     - /var/run/docker.sock:/var/run/docker.sock

the ip address 192.168.1.100 is the host address.

step to reproduce:

  1. docker-compose up -d

  2. install kafka 0.9.0.1 locally by download and install tarball from here and unzip it.

  3. cd kafka_2.11-0.9.0.1

  4. docker ps to find port forwarding for kafka and zookeeper. in my case

     CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS                       PORTS                                                 NAMES
    9352fee6defe        kafkadocker_kafka        "start-kafka.sh"         17 hours ago        Up 17 hours                0.0.0.0:32785->9092/tcp                               kafkadocker_kafka_1
    2a7851f7af61        wurstmeister/zookeeper   "/bin/sh -c '/usr/sbi"   17 hours ago        Up 17 hours                22/tcp, 2888/tcp, 3888/tcp, 0.0.0.0:32784->2181/tcp   kafkadocker_zookeeper_1
    
  5. create topic:

    ~$ bin/kafka-topics.sh --create --topic test --zookeeper 192.168.1.100:32784 --partitions 1 --replication-factor 1
    
  6. show topic info:

    ~$ bin/kafka-topics.sh --describe  --zookeeper 192.168.1.100:32784
    Topic:test PartitionCount:1    ReplicationFactor:1 Configs:
      Topic: test Partition: 0    Leader: 1001    Replicas: 1001  Isr: 1001
    
  7. produce some message:

    $ bin/kafka-console-producer.sh --broker-list="192.168.1.100:32785" --topic test
    abcd
    [2016-05-11 11:21:42,527] WARN Error while fetching metadata with correlation id 0 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:42,625] WARN Error while fetching metadata with correlation id 1 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:42,727] WARN Error while fetching metadata with correlation id 2 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:42,829] WARN Error while fetching metadata with correlation id 3 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:42,931] WARN Error while fetching metadata with correlation id 4 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:43,033] WARN Error while fetching metadata with correlation id 5 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:43,135] WARN Error while fetching metadata with correlation id 6 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:43,237] WARN Error while fetching metadata with correlation id 7 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:43,339] WARN Error while fetching metadata with correlation id 8 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:43,441] WARN Error while fetching metadata with correlation id 9 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:43,543] WARN Error while fetching metadata with correlation id 10 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:43,645] WARN Error while fetching metadata with correlation id 11 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:43,747] WARN Error while fetching metadata with correlation id 12 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:43,849] WARN Error while fetching metadata with correlation id 13 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:43,951] WARN Error while fetching metadata with correlation id 14 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:44,053] WARN Error while fetching metadata with correlation id 15 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:44,155] WARN Error while fetching metadata with correlation id 16 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:44,257] WARN Error while fetching metadata with correlation id 17 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:44,359] WARN Error while fetching metadata with correlation id 18 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    [2016-05-11 11:21:44,462] WARN Error while fetching metadata with correlation id 19 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
    

more debug steps:

  1. port detection

    telnet 192.168.1.100 32785
    Trying 192.168.1.100...
    Connected to 192.168.1.100.
    Escape character is '^]'.
    
    
    Connection closed by foreign host.
    
  2. zookeeper client:

    ls /
    [consumers, config, controller, isr_change_notification, admin, brokers, zookeeper, controller_epoch]
    ls /brokers 
    [seqid, topics, ids]
    ls /brokers/ids
    [1001]
    get /brokers/ids/1001
    {"jmx_port":-1,"timestamp":"1462872416451","endpoints":["PLAINTEXT://192.168.1.100:32785"],"host":"192.168.1.100","version":2,"port":32785}
    cZxid = 0x18
    ctime = Tue May 10 17:26:56 CST 2016
    mZxid = 0x18
    mtime = Tue May 10 17:26:56 CST 2016
    pZxid = 0x18
    cversion = 0
    dataVersion = 0
    aclVersion = 0
    ephemeralOwner = 0x15499fd99150000
    dataLength = 139
    numChildren = 0
    ls /config 
    [topics, clients, changes]
    ls /config/topics
    [test]
    get /config/topics/test
    {"version":1,"config":{}}
    cZxid = 0x1e
    ctime = Tue May 10 17:30:00 CST 2016
    mZxid = 0x1e
    mtime = Tue May 10 17:30:00 CST 2016
    pZxid = 0x1e
    cversion = 0
    dataVersion = 0
    aclVersion = 0
    ephemeralOwner = 0x0
    dataLength = 25
    numChildren = 0
    

from kafka-docker.

pluswave avatar pluswave commented on July 23, 2024

some clue about this issue for my case:

inside the kafka server container (please note I just restart the service so the port mapping changed):

docker exec -it kafkadocker_kafka_1 bash
bash-4.3# netstat -anpt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 :::33304                :::*                    LISTEN      103/java
tcp        0      0 :::9092                 :::*                    LISTEN      103/java
tcp        0      1 ::ffff:172.17.0.8:46190 ::ffff:192.168.1.100:32791 SYN_SENT    103/java
tcp        0      0 ::ffff:172.17.0.8:57736 ::ffff:172.17.0.7:2181  ESTABLISHED 103/java

the SYN_SENT indicate the cause (but not root cause). from the kafka server (docker instance), it can't connect to DockerHost:ForwardPort to any kafka server in cluster. Instead, it can only connect to some BridgedIp:9092 but it is NOT advertised by zookeeper. However from outside world, the bridged network is not visible but only fowarded port and docker host.

The problem now is : how to fix it ?

from kafka-docker.

pluswave avatar pluswave commented on July 23, 2024

ok should be this issue: moby/moby#16137

from kafka-docker.

wurstmeister avatar wurstmeister commented on July 23, 2024

Hi,

sorry for the late reply, this could indeed be a firewall issue. sounds very similar to #30

@madfrog2047 the output of broker-list.sh depends on how you started start-kafka-shell.sh, which is where it is supposed to be used (see https://github.com/wurstmeister/kafka-docker/blob/master/broker-list.sh#L4)

from kafka-docker.

bikeholik avatar bikeholik commented on July 23, 2024

I've got it working disabling firewalld completely (on Fedora 23) for test purposes...

from kafka-docker.

lidel avatar lidel commented on July 23, 2024

@madfrog2047 Just out of curiosity, did you set a (custom) low tickTime in ZooKeeper by any chance? I had the same error with tickTime=10 and it is gone with tickTime=500 (embedded Kafka+ZooKeeper in JUnits).

from kafka-docker.

junjiemars avatar junjiemars commented on July 23, 2024

set advertised.host.name=<container's-ip> in Kafka's server.properties solve my problem.

from kafka-docker.

Hubbitus avatar Hubbitus commented on July 23, 2024

It seams related to moby/moby#26594

As workaround you may use HOSTNAME_COMMAND instead of providing IP statically.
So f.e. If I add in environment section of docker-compose.yml file line:

HOSTNAME_COMMAND: "getent hosts `hostname` | cut -d' ' -f1"

it works for me.

from kafka-docker.

ppromsiri avatar ppromsiri commented on July 23, 2024

Hi All

I found workaround
add KAFKA_ADVERTISED_LISTENERS:
in section environment docker-compose.yml

it works. Let's try

from kafka-docker.

jeven2016 avatar jeven2016 commented on July 23, 2024

yes, the KAFKA_ADVERTISED_LISTENERS is very useful, and following is my yml file for reference:

version: '2'
services:
zookeeper:
image: wurstmeister/zookeeper
ports:
- "5804:2181"
kafka:
image: wurstmeister/kafka
ports:
- "5805:9092"
environment:
KAFKA_ADVERTISED_LISTENERS: 10.196.10.6:9092
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
volumes:
- /var/run/docker.sock:/var/run/docker.sock

from kafka-docker.

LuisIvanMD avatar LuisIvanMD commented on July 23, 2024

Hi Guys,

Had the same issue as you, and disabling the Firewall worked fine for me. Did anyone went further on searching which rule we should add to Firewall and be able to leave it active?

Thanks a lot.

Thar works for me

from kafka-docker.

JOJO0527 avatar JOJO0527 commented on July 23, 2024

I've got it working disabling firewalld completely (on Fedora 23) for test purposes...

it works for me too! thanks

from kafka-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.