使用Docker启动Kafka-Manager

Docker安装Kafka-Manager(docker-compose.yml)
 

前置条件

请先安装Docker 

 

创建docker-compose.yml

# Docker compose to have Zookeeper, Kafka, and Kafka Manager running for development.
# Provided by @chris-zen

zookeeper:
  image: confluent/zookeeper
  ports:
    - "2181:2181"

kafka:
  image: wurstmeister/kafka:0.9.0.0-1
  ports:
    - "9092:9092"
  links:
    - zookeeper:zk
  environment:
    - KAFKA_ADVERTISED_HOST_NAME
    - 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


kafka-manager:
  image: sheepkiller/kafka-manager:latest
  ports:
    - "9000:9000"
  links:
    - zookeeper
    - kafka
  environment:
    ZK_HOSTS: zookeeper:2181
    APPLICATION_SECRET: letmein
    KM_ARGS: -Djava.net.preferIPv4Stack=true

将以上文件保存为docker-compose.yml文件

 

启动docker-compose脚本

docker-compose up

启动docker-compose(后台模式-不打印日志)
docker-compose up -d

 

管理界面

使用Docker启动Kafka-Manager_第1张图片

使用Docker启动Kafka-Manager_第2张图片

 

启动日志

AppledeMacBook-Pro:kafka-manager apple$ docker-compose up 
Pulling kafka (wurstmeister/kafka:0.9.0.0-1)...
0.9.0.0-1: Pulling from wurstmeister/kafka
c52e3ed763ff: Pull complete
a3ed95caeb02: Pull complete
6fc670700a21: Pull complete
eb9ce11730d2: Pull complete
48b598e41162: Pull complete
ef2baefa0cc9: Pull complete
8efc855bac02: Pull complete
f627a02ab59b: Pull complete
9d297f75285f: Pull complete
Pulling kafka-manager (sheepkiller/kafka-manager:latest)...
latest: Pulling from sheepkiller/kafka-manager
469cfcc7a4b3: Pull complete
4458b033eac3: Pull complete
838a0ff6e24f: Pull complete
0128a98dafdb: Pull complete
Creating kafka-manager_zookeeper_1 ... done
Creating kafka-manager_kafka_1     ... done
Creating kafka-manager_kafka-manager_1 ... done
Attaching to kafka-manager_zookeeper_1, kafka-manager_kafka_1, kafka-manager_kafka-manager_1
zookeeper_1      |  INFO [main] (PropertyEditor.java:125) - Reading properties from /etc/kafka/zookeeper.properties
zookeeper_1      |  INFO [main] (PropertyEditor.java:112) - Overriding value for id with value from environment variable zk_id
zookeeper_1      |  INFO [main] (PropertyEditor.java:112) - Overriding value for maxClientCnxns with value from environment variable zk_maxClientCnxns
zookeeper_1      |  INFO [main] (PropertyEditor.java:112) - Overriding value for initLimit with value from environment variable zk_initLimit
zookeeper_1      |  INFO [main] (PropertyEditor.java:112) - Overriding value for DATA.DIR with value from environment variable ZK_DATA_DIR
zookeeper_1      |  INFO [main] (PropertyEditor.java:112) - Overriding value for syncLimit with value from environment variable zk_syncLimit
zookeeper_1      |  INFO [main] (PropertyEditor.java:112) - Overriding value for clientPort with value from environment variable zk_clientPort
zookeeper_1      |  INFO [main] (PropertyEditor.java:112) - Overriding value for dataDir with value from environment variable zk_dataDir
zookeeper_1      |  INFO [main] (PropertyEditor.java:112) - Overriding value for tickTime with value from environment variable zk_tickTime
zookeeper_1      |  INFO [main] (PropertyEditor.java:147) - Writing properties to /etc/kafka/zookeeper.properties
kafka_1          | waiting for kafka to be ready
zookeeper_1      | [2019-04-16 13:45:41,027] INFO Reading configuration from: /etc/kafka/zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
zookeeper_1      | [2019-04-16 13:45:41,034] INFO autopurge.snapRetainCount set to 3 (org.apache.zookeeper.server.DatadirCleanupManager)
zookeeper_1      | [2019-04-16 13:45:41,035] INFO autopurge.purgeInterval set to 0 (org.apache.zookeeper.server.DatadirCleanupManager)
zookeeper_1      | [2019-04-16 13:45:41,036] INFO Purge task is not scheduled. (org.apache.zookeeper.server.DatadirCleanupManager)
zookeeper_1      | [2019-04-16 13:45:41,038] WARN Either no config or no quorum defined in config, running  in standalone mode (org.apache.zookeeper.server.quorum.QuorumPeerMain)
zookeeper_1      | [2019-04-16 13:45:41,165] INFO Reading configuration from: /etc/kafka/zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
zookeeper_1      | [2019-04-16 13:45:41,166] INFO Starting server (org.apache.zookeeper.server.ZooKeeperServerMain)
zookeeper_1      | [2019-04-16 13:45:41,281] INFO Server environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,287] INFO Server environment:host.name=c70f87b117cb (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,288] INFO Server environment:java.version=1.8.0_91 (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,288] INFO Server environment:java.vendor=Oracle Corporation (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,288] INFO Server environment:java.home=/usr/lib/jvm/java-8-openjdk-amd64/jre (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,289] INFO Server environment:java.class.path=:/usr/bin/../share/java/kafka/reflections-0.9.10.jar:/usr/bin/../share/java/kafka/log4j-1.2.17.jar:/usr/bin/../share/java/kafka/osgi-resource-locator-1.0.1.jar:/usr/bin/../share/java/kafka/support-metrics-common-3.0.0.jar:/usr/bin/../share/java/kafka/jackson-jaxrs-json-provider-2.6.3.jar:/usr/bin/../share/java/kafka/hk2-api-2.4.0-b34.jar:/usr/bin/../share/java/kafka/commons-logging-1.2.jar:/usr/bin/../share/java/kafka/connect-file-0.10.0.0-cp1.jar:/usr/bin/../share/java/kafka/scala-library-2.11.8.jar:/usr/bin/../share/java/kafka/validation-api-1.1.0.Final.jar:/usr/bin/../share/java/kafka/jetty-http-9.2.15.v20160210.jar:/usr/bin/../share/java/kafka/commons-codec-1.9.jar:/usr/bin/../share/java/kafka/jetty-servlets-9.2.15.v20160210.jar:/usr/bin/../share/java/kafka/jackson-databind-2.6.3.jar:/usr/bin/../share/java/kafka/kafka-streams-examples-0.10.0.0-cp1.jar:/usr/bin/../share/java/kafka/lz4-1.3.0.jar:/usr/bin/../share/java/kafka/slf4j-log4j12-1.7.21.jar:/usr/bin/../share/java/kafka/commons-lang3-3.1.jar:/usr/bin/../share/java/kafka/kafka.jar:/usr/bin/../share/java/kafka/jetty-security-9.2.15.v20160210.jar:/usr/bin/../share/java/kafka/xz-1.0.jar:/usr/bin/../share/java/kafka/hk2-utils-2.4.0-b34.jar:/usr/bin/../share/java/kafka/connect-api-0.10.0.0-cp1.jar:/usr/bin/../share/java/kafka/jetty-util-9.2.15.v20160210.jar:/usr/bin/../share/java/kafka/jackson-annotations-2.6.0.jar:/usr/bin/../share/java/kafka/jackson-core-asl-1.9.13.jar:/usr/bin/../share/java/kafka/paranamer-2.3.jar:/usr/bin/../share/java/kafka/commons-collections-3.2.1.jar:/usr/bin/../share/java/kafka/zookeeper-3.4.6.jar:/usr/bin/../share/java/kafka/jackson-core-2.6.3.jar:/usr/bin/../share/java/kafka/kafka-clients-0.10.0.0-cp1.jar:/usr/bin/../share/java/kafka/aopalliance-repackaged-2.4.0-b34.jar:/usr/bin/../share/java/kafka/jetty-server-9.2.15.v20160210.jar:/usr/bin/../share/java/kafka/jackson-module-jaxb-annotations-2.6.3.jar:/usr/bin/../share/java/kafka/scala-parser-combinators_2.11-1.0.4.jar:/usr/bin/../share/java/kafka/jersey-container-servlet-core-2.22.2.jar:/usr/bin/../share/java/kafka/httpclient-4.5.1.jar:/usr/bin/../share/java/kafka/kafka_2.11-0.10.0.0-cp1-test-sources.jar:/usr/bin/../share/java/kafka/jersey-client-2.22.2.jar:/usr/bin/../share/java/kafka/jopt-simple-4.9.jar:/usr/bin/../share/java/kafka/jackson-jaxrs-base-2.6.3.jar:/usr/bin/../share/java/kafka/javax.inject-2.4.0-b34.jar:/usr/bin/../share/java/kafka/connect-runtime-0.10.0.0-cp1.jar:/usr/bin/../share/java/kafka/javassist-3.18.2-GA.jar:/usr/bin/../share/java/kafka/guava-18.0.jar:/usr/bin/../share/java/kafka/connect-json-0.10.0.0-cp1.jar:/usr/bin/../share/java/kafka/jersey-container-servlet-2.22.2.jar:/usr/bin/../share/java/kafka/kafka_2.11-0.10.0.0-cp1-test.jar:/usr/bin/../share/java/kafka/commons-beanutils-1.8.3.jar:/usr/bin/../share/java/kafka/javax.annotation-api-1.2.jar:/usr/bin/../share/java/kafka/commons-compress-1.4.1.jar:/usr/bin/../share/java/kafka/httpmime-4.5.1.jar:/usr/bin/../share/java/kafka/jersey-guava-2.22.2.jar:/usr/bin/../share/java/kafka/support-metrics-client-3.0.0.jar:/usr/bin/../share/java/kafka/slf4j-api-1.7.21.jar:/usr/bin/../share/java/kafka/httpcore-4.4.3.jar:/usr/bin/../share/java/kafka/argparse4j-0.5.0.jar:/usr/bin/../share/java/kafka/javax.inject-1.jar:/usr/bin/../share/java/kafka/commons-validator-1.4.1.jar:/usr/bin/../share/java/kafka/zkclient-0.8.jar:/usr/bin/../share/java/kafka/javax.servlet-api-3.1.0.jar:/usr/bin/../share/java/kafka/kafka-streams-0.10.0.0-cp1.jar:/usr/bin/../share/java/kafka/metrics-core-2.2.0.jar:/usr/bin/../share/java/kafka/avro-1.7.7.jar:/usr/bin/../share/java/kafka/rocksdbjni-4.4.1.jar:/usr/bin/../share/java/kafka/jetty-io-9.2.15.v20160210.jar:/usr/bin/../share/java/kafka/kafka_2.11-0.10.0.0-cp1-scaladoc.jar:/usr/bin/../share/java/kafka/kafka_2.11-0.10.0.0-cp1-sources.jar:/usr/bin/../share/java/kafka/snappy-java-1.1.2.4.jar:/usr/bin/../share/java/kafka/jetty-continuation-9.2.15.v20160210.jar:/usr/bin/../share/java/kafka/hk2-locator-2.4.0-b34.jar:/usr/bin/../share/java/kafka/jackson-mapper-asl-1.9.13.jar:/usr/bin/../share/java/kafka/commons-digester-1.8.1.jar:/usr/bin/../share/java/kafka/kafka_2.11-0.10.0.0-cp1-javadoc.jar:/usr/bin/../share/java/kafka/jersey-server-2.22.2.jar:/usr/bin/../share/java/kafka/javax.ws.rs-api-2.0.1.jar:/usr/bin/../share/java/kafka/jersey-media-jaxb-2.22.2.jar:/usr/bin/../share/java/kafka/jetty-servlet-9.2.15.v20160210.jar:/usr/bin/../share/java/kafka/kafka-tools-0.10.0.0-cp1.jar:/usr/bin/../share/java/kafka/kafka-log4j-appender-0.10.0.0-cp1.jar:/usr/bin/../share/java/kafka/kafka_2.11-0.10.0.0-cp1.jar:/usr/bin/../share/java/kafka/jersey-common-2.22.2.jar:/usr/bin/../share/java/confluent-support-metrics/support-metrics-fullcollector-3.0.0.jar:/usr/share/java/confluent-support-metrics/support-metrics-fullcollector-3.0.0.jar (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,290] INFO Server environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,293] INFO Server environment:java.io.tmpdir=/tmp (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,294] INFO Server environment:java.compiler= (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,295] INFO Server environment:os.name=Linux (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,295] INFO Server environment:os.arch=amd64 (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,295] INFO Server environment:os.version=4.9.125-linuxkit (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,325] INFO Server environment:user.name=confluent (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,331] INFO Server environment:user.home=/home/confluent (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,331] INFO Server environment:user.dir=/ (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,390] INFO tickTime set to 2000 (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,398] INFO minSessionTimeout set to -1 (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,399] INFO maxSessionTimeout set to -1 (org.apache.zookeeper.server.ZooKeeperServer)
zookeeper_1      | [2019-04-16 13:45:41,455] INFO binding to port 0.0.0.0/0.0.0.0:2181 (org.apache.zookeeper.server.NIOServerCnxnFactory)

 

你可能感兴趣的:(Docker,kafka)