Skip to content

Instantly share code, notes, and snippets.

@dobeerman
Forked from dkurzaj/README.md
Created October 9, 2022 09:48
Show Gist options
  • Save dobeerman/7ba3c9814a8fb14431d4a547dfe7fac4 to your computer and use it in GitHub Desktop.
Save dobeerman/7ba3c9814a8fb14431d4a547dfe7fac4 to your computer and use it in GitHub Desktop.

Revisions

  1. @dkurzaj dkurzaj revised this gist Feb 16, 2018. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -19,11 +19,11 @@ $ docker-compose -f docker-compose.yml up -d

    - Access Kafka Manager : http://localhost:9000/.

    - Create a new cluster.
    - Add a new cluster.

    - Name it as you like (**Localtest** for example).

    - IP : zookeeper:2181
    - IP : localhost:2181

    - Kafka version (corresponding here to the Kafka version inside the image : **wurstmeister/kafka:1.0.0**). But as I write this Gist, the latest Kafka version available in Kafka Manager is **0.11.0.0** so I select this one, but it's sufficiently compatible with the 1.0.0 version of Kafka according to this topic: https://github.com/yahoo/kafka-manager/issues/451

    @@ -33,7 +33,7 @@ $ docker-compose -f docker-compose.yml up -d

    - Tick **Enable Active OffsetCache** to see the offsets

    And then create it.
    And then save it.

    :sparkles: This is done ! :sparkles:

  2. @dkurzaj dkurzaj revised this gist Feb 16, 2018. 2 changed files with 4 additions and 4 deletions.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ Gist inspired by this one intending to be an updated version of it : https://gis
    ## Install
    - Create the environment variable that contains our host name (IP address) :
    ```
    $ export DOCKER_HOST=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
    $ export EXPOSED_HOSTNAME=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
    ```

    - Create the folders :
    6 changes: 3 additions & 3 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -21,8 +21,8 @@ services:
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    environment:
    - KAFKA_ZOOKEEPER_CONNECT=${DOCKER_HOST}:2181
    - KAFKA_ADVERTISED_HOST_NAME=${DOCKER_HOST}
    - KAFKA_ZOOKEEPER_CONNECT=${EXPOSED_HOSTNAME}:2181
    - KAFKA_ADVERTISED_HOST_NAME=${EXPOSED_HOSTNAME}
    - JMX_PORT=9093
    - KAFKA_ADVERTISED_PORT=9092
    - KAFKA_DELETE_TOPIC_ENABLE=true
    @@ -46,7 +46,7 @@ services:
    - zookeeper
    command: -Dconfig.file=/kafka-manager/conf/application.conf -Dapplication.home=/kafkamanager
    environment:
    - ZK_HOSTS=${DOCKER_HOST}
    - ZK_HOSTS=${EXPOSED_HOSTNAME}
    - APPLICATION_SECRET=letmein
    ports:
    - "9000:9000"
  3. @dkurzaj dkurzaj revised this gist Feb 16, 2018. 1 changed file with 2 additions and 6 deletions.
    8 changes: 2 additions & 6 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # Docker compose Kafka, Zookeeper and Kafka manager
    Gist inspired by this one intending to be an updated version of it : https://gist.github.com/17twenty/d619f922ab209f750630824f7c6836e3
    ## Install
    - Create the environment variable that contains our host name (IP address) :
    ```
    @@ -46,9 +47,4 @@ $ docker-compose -f docker-compose.yml stop && docker-compose -f docker-compose.
    - Remove content of Docker volumes (we need to do this trick to remove hidden and non-hidden files) :
    ```
    $ rm -rf zookeeper/{data,logs} && mkdir -p zookeeper/{data,logs}
    ```




    Gist inspired by this one intending to be an updated version of it : https://gist.github.com/17twenty/d619f922ab209f750630824f7c6836e3
    ```
  4. @dkurzaj dkurzaj revised this gist Feb 16, 2018. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@ $ docker-compose -f docker-compose.yml up -d

    And then create it.

    This is done !
    :sparkles: This is done ! :sparkles:

    ## Uninstall
    - Stop the containers and remove them :
    @@ -48,4 +48,7 @@ $ docker-compose -f docker-compose.yml stop && docker-compose -f docker-compose.
    $ rm -rf zookeeper/{data,logs} && mkdir -p zookeeper/{data,logs}
    ```




    Gist inspired by this one intending to be an updated version of it : https://gist.github.com/17twenty/d619f922ab209f750630824f7c6836e3
  5. @dkurzaj dkurzaj revised this gist Feb 16, 2018. 2 changed files with 28 additions and 33 deletions.
    19 changes: 8 additions & 11 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,13 @@
    # Docker compose Kafka, Zookeeper and Kafka manager
    ## Install
    - Create the network :
    - Create the environment variable that contains our host name (IP address) :
    ```
    $ docker network create --driver bridge kafka-net
    $ export DOCKER_HOST=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
    ```

    - Create the folders :
    ```
    $ mkdir -p {zookeeper,kafka}/{data,logs}
    $ mkdir -p zookeeper/{data,logs}
    ```

    ## Run
    @@ -24,7 +24,7 @@ $ docker-compose -f docker-compose.yml up -d

    - IP : zookeeper:2181

    - Kafka version (corresponding here to the Kafka version inside the image : **ches/kafka:0.10.2.1**) : 0.10.2.1
    - Kafka version (corresponding here to the Kafka version inside the image : **wurstmeister/kafka:1.0.0**). But as I write this Gist, the latest Kafka version available in Kafka Manager is **0.11.0.0** so I select this one, but it's sufficiently compatible with the 1.0.0 version of Kafka according to this topic: https://github.com/yahoo/kafka-manager/issues/451

    - Tick **Enable JMX Polling** in order to see the metrics of the topics

    @@ -42,13 +42,10 @@ This is done !
    $ docker-compose -f docker-compose.yml stop && docker-compose -f docker-compose.yml rm -vf
    ```

    - Remove the docker network :
    ```
    $ docker network rm kafka-net
    ```

    ## Tips
    - Remove content of Docker volumes (we need to do this trick to remove hidden and non-hidden files) :
    ```
    $ rm -rf {zookeeper,kafka}/{data,logs} && mkdir -p {zookeeper,kafka}/{data,logs}
    ```
    $ rm -rf zookeeper/{data,logs} && mkdir -p zookeeper/{data,logs}
    ```

    Gist inspired by this one intending to be an updated version of it : https://gist.github.com/17twenty/d619f922ab209f750630824f7c6836e3
    42 changes: 20 additions & 22 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,5 @@
    version: '3.1'

    networks:
    default:
    external:
    name: kafka-net

    services:
    zookeeper:
    container_name: zookeeper
    @@ -15,27 +10,32 @@ services:
    - "./zookeeper/logs:/datalog"
    ports:
    - "2181:2181"
    network_mode: "host"

    kafka:
    container_name: kafka
    image: ches/kafka:0.10.2.1
    image: wurstmeister/kafka:1.0.0
    restart: on-failure
    depends_on:
    - zookeeper
    links:
    - zookeeper
    volumes:
    - "./kafka/data:/data"
    - "./kafka/logs:/logs"
    - /var/run/docker.sock:/var/run/docker.sock
    environment:
    - ZOOKEEPER_IP=zookeeper
    - JMX_PORT=7203
    - JAVA_RMI_SERVER_HOSTNAME=kafka
    - KAFKA_LOG_RETENTION_HOURS=168
    - KAFKA_AUTO_CREATE_TOPICS_ENABLE=true
    - KAFKA_ZOOKEEPER_CONNECT=${DOCKER_HOST}:2181
    - KAFKA_ADVERTISED_HOST_NAME=${DOCKER_HOST}
    - JMX_PORT=9093
    - KAFKA_ADVERTISED_PORT=9092
    - KAFKA_DELETE_TOPIC_ENABLE=true
    - KAFKA_LOG_RETENTION_HOURS=1
    - KAFKA_MESSAGE_MAX_BYTES=10000000
    - KAFKA_REPLICA_FETCH_MAX_BYTES=10000000
    - KAFKA_GROUP_MAX_SESSION_TIMEOUT_MS=60000
    - KAFKA_NUM_PARTITIONS=2
    - KAFKA_DELETE_RETENTION_MS=1000
    ports:
    - "9092:9092"
    - "7203:7203"
    - "9093:9093"
    network_mode: "host"

    kafka-manager:
    container_name: kafka-manager
    @@ -44,12 +44,10 @@ services:
    depends_on:
    - kafka
    - zookeeper
    links:
    - kafka
    - zookeeper
    command: -Dconfig.file=/kafka-manager/conf/application.conf -Dkafka-manager.zkhosts="zookeeper:2181"
    command: -Dconfig.file=/kafka-manager/conf/application.conf -Dapplication.home=/kafkamanager
    environment:
    - ZK_HOSTS=zookeeper:2181
    - ZK_HOSTS=${DOCKER_HOST}
    - APPLICATION_SECRET=letmein
    ports:
    - "9000:9000"
    - "9000:9000"
    network_mode: "host"
  6. @dkurzaj dkurzaj revised this gist Feb 15, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # How to use
    # Docker compose Kafka, Zookeeper and Kafka manager
    ## Install
    - Create the network :
    ```
  7. @dkurzaj dkurzaj revised this gist Feb 15, 2018. 2 changed files with 9 additions and 1 deletion.
    6 changes: 6 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -26,6 +26,12 @@ $ docker-compose -f docker-compose.yml up -d

    - Kafka version (corresponding here to the Kafka version inside the image : **ches/kafka:0.10.2.1**) : 0.10.2.1

    - Tick **Enable JMX Polling** in order to see the metrics of the topics

    - Tick **Poll consumer information** to know the consumer of a topic (it may not work)

    - Tick **Enable Active OffsetCache** to see the offsets

    And then create it.

    This is done !
    4 changes: 3 additions & 1 deletion docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -29,11 +29,13 @@ services:
    - "./kafka/logs:/logs"
    environment:
    - ZOOKEEPER_IP=zookeeper
    - JMX_PORT=9994
    - JMX_PORT=7203
    - JAVA_RMI_SERVER_HOSTNAME=kafka
    - KAFKA_LOG_RETENTION_HOURS=168
    - KAFKA_AUTO_CREATE_TOPICS_ENABLE=true
    ports:
    - "9092:9092"
    - "7203:7203"

    kafka-manager:
    container_name: kafka-manager
  8. @dkurzaj dkurzaj revised this gist Feb 15, 2018. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -39,4 +39,10 @@ $ docker-compose -f docker-compose.yml stop && docker-compose -f docker-compose.
    - Remove the docker network :
    ```
    $ docker network rm kafka-net
    ```

    ## Tips
    - Remove content of Docker volumes (we need to do this trick to remove hidden and non-hidden files) :
    ```
    $ rm -rf {zookeeper,kafka}/{data,logs} && mkdir -p {zookeeper,kafka}/{data,logs}
    ```
  9. @dkurzaj dkurzaj revised this gist Feb 15, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -38,5 +38,5 @@ $ docker-compose -f docker-compose.yml stop && docker-compose -f docker-compose.

    - Remove the docker network :
    ```
    docker network rm kafka-net
    $ docker network rm kafka-net
    ```
  10. @dkurzaj dkurzaj revised this gist Feb 15, 2018. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -30,7 +30,13 @@ And then create it.

    This is done !

    To stop the containers and remove them, run :
    ## Uninstall
    - Stop the containers and remove them :
    ```
    $ docker-compose -f docker-compose.yml stop && docker-compose -f docker-compose.yml rm -vf
    ```

    - Remove the docker network :
    ```
    docker network rm kafka-net
    ```
  11. @dkurzaj dkurzaj revised this gist Feb 15, 2018. 1 changed file with 36 additions and 0 deletions.
    36 changes: 36 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    # How to use
    ## Install
    - Create the network :
    ```
    $ docker network create --driver bridge kafka-net
    ```

    - Create the folders :
    ```
    $ mkdir -p {zookeeper,kafka}/{data,logs}
    ```

    ## Run
    - Execute the docker compose :
    ```
    $ docker-compose -f docker-compose.yml up -d
    ```

    - Access Kafka Manager : http://localhost:9000/.

    - Create a new cluster.

    - Name it as you like (**Localtest** for example).

    - IP : zookeeper:2181

    - Kafka version (corresponding here to the Kafka version inside the image : **ches/kafka:0.10.2.1**) : 0.10.2.1

    And then create it.

    This is done !

    To stop the containers and remove them, run :
    ```
    $ docker-compose -f docker-compose.yml stop && docker-compose -f docker-compose.yml rm -vf
    ```
  12. @dkurzaj dkurzaj created this gist Feb 15, 2018.
    53 changes: 53 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    version: '3.1'

    networks:
    default:
    external:
    name: kafka-net

    services:
    zookeeper:
    container_name: zookeeper
    image: zookeeper:3.4
    restart: on-failure
    volumes:
    - "./zookeeper/data:/data"
    - "./zookeeper/logs:/datalog"
    ports:
    - "2181:2181"

    kafka:
    container_name: kafka
    image: ches/kafka:0.10.2.1
    restart: on-failure
    depends_on:
    - zookeeper
    links:
    - zookeeper
    volumes:
    - "./kafka/data:/data"
    - "./kafka/logs:/logs"
    environment:
    - ZOOKEEPER_IP=zookeeper
    - JMX_PORT=9994
    - KAFKA_LOG_RETENTION_HOURS=168
    - KAFKA_AUTO_CREATE_TOPICS_ENABLE=true
    ports:
    - "9092:9092"

    kafka-manager:
    container_name: kafka-manager
    image: hlebalbau/kafka-manager:1.3.3.16
    restart: on-failure
    depends_on:
    - kafka
    - zookeeper
    links:
    - kafka
    - zookeeper
    command: -Dconfig.file=/kafka-manager/conf/application.conf -Dkafka-manager.zkhosts="zookeeper:2181"
    environment:
    - ZK_HOSTS=zookeeper:2181
    - APPLICATION_SECRET=letmein
    ports:
    - "9000:9000"