0
votes

I am trying to deploy kafka by docker-compose file or evenby installing kafka image and run it manually. Both of these steps are giving to me that error when I start to run kafka server(broker)

INFO Initiating client connection, connectString=188.226.151.167:2181 sessionTimeout=6000 watcher=org.I0Itec.zkclient.ZkClient@323b36e0 (org.apache.zookeeper.ZooKeeper) [2017-05-16 13:44:49,903] INFO Waiting for keeper state SyncConnected (org.I0Itec.zkclient.ZkClient) [2017-05-16 13:44:49,909] INFO Opening socket connection to server 188.226.151.167/188.226.151.167:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn) [2017-05-16 13:44:55,904] INFO Terminate ZkClient event thread. (org.I0Itec.zkclient.ZkEventThread)

Could anyone has clear explanation of what happens and the clear explanation about how to fix it

3
Can you please share your docker-compose?Also, please share the docker version and OS you are working on.humblebee
docker compose file version: '2' services: zookeeper: image: wurstmeister/zookeeper ports: - "2181:2181" kafka: build: . ports: - "9092:9092" environment: KAFKA_ADVERTISED_HOST_NAME: 192.168.99.100 KAFKA_CREATE_TOPICS: "test:1:1" KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 volumes: - /var/run/docker.sock:/var/run/docker.sockEman
OS version : Ubuntu 16.04 Docker Version: Docker version 17.04.0-ceEman

3 Answers

0
votes

Try this:

kafka:
  network_mode: 'bridge'
  image: wurstmeister/kafka
  links:
    - zookeeper
  environment:
    HOSTNAME_COMMAND: "hostname -I | awk -F' ' '{print $$1}'"
    KAFKA_ADVERTISED_PORT: 9092
    KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
zookeeper:
  network_mode: 'bridge'
  image: wurstmeister/zookeeper
0
votes

I have setup my docker compose as this and everything works perfectly:

version: '2'
services:
  zookeeper:
    image: wurstmeister/zookeeper
    ports:
      - 2181:2181
    hostname: zookeeper
    container_name: zookeeper
    volumes:
      - /tmp/docker/zk1/logs:/logs
      - /tmp/docker/zk1/data:/data
  kafka:
    image: wurstmeister/kafka
    ports:
      - 9092:9092
    depends_on:
      - zookeeper
    environment:
      KAFKA_CREATE_TOPICS: "test1:1:1,test2:1:1"
      HOSTNAME_COMMAND: "route -n | awk '/UG[ \t]/{print $$2}'"
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /tmp/docker/kafka/logs:/logs
      - /tmp/docker/kafka/data:/data
      - ./tmp/docker/kafka/kafka-logs:/kafka
    hostname: kafka
    container_name: kafka

I have setup the ports to be like '2181:2181' and not just '2181' so that to be accessible outside my container.

I have also set the volumes so that every time I restart the container to remember all the data from previous time.

0
votes

It solved all kafka with docker connection by outside machines by disabling firewall connection Command: ufw disable