Sign inSign up

monasca/kafka

By monasca

•Updated almost 6 years ago

Kafka with dynamic configuration, auto hostname detection and topic creaton, and ZK checks

Image
0

10K+

monasca/kafka repository overview

⁠monasca/kafka Dockerfile

This image runs an instance of Apache Kafka⁠ optimized for Docker and Kubernetes environments.

Sources: kafka⁠ · Dockerfile⁠ · monasca-docker⁠

⁠Tags

Images in this repository are tagged as follows:

  • [kafka version]-[scala version], e.g. 0.9.0.1-2.11
  • latest: the latest version recommended for use with other Monasca components. Currently, this is 0.9.0.1-2.11
  • master: a development / testing build not necessarily intended for production use

⁠Usage

Kafka requires a running instance of Zookeeper. The library zookeeper image⁠ is recommended:

docker run --name zookeeper -d zookeeper:3.3

If Zookeeper is accessible at zookeeper:2181, no additional options need to be specified:

docker run --name kafka --link zookeeper monasca/kafka:latest

Kafka will be running on port 9092 by default. If JMX is enabled, that port will be available as well (7203 by default). These ports can be exposed as necessary (-p 9092:9092 or similar), but keep in mind that forwarding ports will impact connectivity unless KAFKA_ADVERTISED_HOST_NAME is set correctly as described below.

⁠Configuration

Several parameters can be specified using environment variables:

VariableDefaultDescription
ZOOKEEPER_CONNECTION_STRINGzookeeper:2181Comma-separated list of ZK hosts
ZOOKEEPER_WAITtrueIf true, wait for zookeeper to become ready
ZOOKEEPER_WAIT_TIMEOUT3Connection timeout for ZK wait loop
ZOOKEEPER_WAIT_DELAY10Seconds to wait between connection attempts
ZOOKEEPER_WAIT_RETRIES20Password for given user
ZOOKEEPER_CHROOTunsetOptional ZK chroot / path prefix
KAFKA_HOSTNAME_FROM_IPtrueIf true, set advertised hostname to container IP
KAFKA_ADVERTISED_HOST_NAMEfrom IPIf set, use value as advertised hostname
KAFKA_BROKER_ID-1Unique Kafka broker ID, -1 for auto
KAFKA_LISTEN_PORT9092Port for Kafka to listen on
KAFKA_ADVERTISED_PORT$KAFKA_LISTEN_PORTKafka port advertised to clients
KAFKA_CONTROLLED_SHUTDOWN_ENABLEtrueIf true, enable controlled shutdown⁠
KAFKA_JMXunsetIf true, expose JMX metrics over TCP
KAFKA_JMX_PORT7203Port to expose JMX metrics
KAFKA_JMX_OPTSno SSL/auth, etcOverride default opts
SERVER_LOG_LEVELINFOLog Level for server
REQUEST_LOG_LEVELWARNLog Level for request logging
CONTROLLER_LOG_LEVELINFOLog Level for controller
LOG_CLEANER_LOG_LEVELINFOLog Level for log cleaner
STATE_CHANGE_LOG_LEVELINFOLog Level for state changes
AUTHORIZER_LOG_LEVELWARNLog Level for the authorizer
GC_LOG_ENABLEDFalseIf True, JVM garbage collection log enabled
KAFKA_STACK_SIZE1024kJVM stack size
LOG_RETENTION_HOURS4Number of hours to keep a log file
LOG_ROLL_MS900000Number of ms before a new log segment is rolled out
STAY_ALIVE_ON_FAILUREfalseIf true, container stays alive for 2 hours after kafka exits
⁠Log Files

Multiple Kafka log files are written to stdout for the container. They can be distinguished via the logfile attribute in each message. For example:

kafka_1                 | [2017-06-15 06:32:09,572] INFO logfile=server.log Loading logs. (kafka.log.LogManager)

If GC_LOG_ENABLED is set to True, the JVM Garbage Collection log will be written within the container at /kafka/logs/kafkaServer-gc.log. It can't be redirected to stdout.

Tag summary

Content type

Image

Digest

Size

87.3 MB

Last updated

about 9 years ago

docker pull monasca/kafka