Ansible role to install and configure [Apache Kafka][1] 2.0.0 on Ubuntu Server 18.04.3
Apache Kafka is a message bus using publish-subscribe topics. Other components and products can consume these messages by subscribing to these topics. Kafka is extremely fast, handling megabytes of reads and writes per second from thousands of clients. Messages are persisted and replicated to prevent data loss. Data streams are partitioned and can be elastically scaled with no downtime.
Platform: Ubuntu Server 18.04
Java: Java 8
The Oracle Java 8 JDK role from Ansible Galaxy can be used if one is needed.
$ ansible-galaxy install sleighzy.java-8
Apache ZooKeeper
The below zookeeper role from Ansible Galaxy can be used if one is needed.
$ ansible-galaxy install sleighzy.zookeeper
kafka_version: 2.3.0
kafka_scala_version: 2.12
kafka_root_dir: /opt
kafka_dir: '{{ kafka_root_dir }}/kafka'
kafka_broker_id: 0
kafka_listener_protocol: PLAINTEXT
kafka_listener_hostname: localhost
kafka_listener_port: 9092
kafka_num_network_threads: 3
kafka_log_dirs: /var/lib/kafka-logs
kafka_num_partitions: 1
kafka_log_retention_hours: 168
kafka_auto_create_topics_enable: true
kafka_delete_topic_enable: true
kafka_default_replication_factor: 1
kafka_zookeeper_connect: 'localhost:2181'
kafka_zookeeper_connection_timeout: 6000
kafka_bootstrap_servers: 'localhost:9092'
kafka_consumer_group_id: kafka-consumer-group
- The Kafka service can be started via:
systemctl start kafka
- The Kafka service can be stopped via:
systemctl stop kafka
- The Kafka service can be started via:
service kafka start
- The Kafka service can be stopped via:
service kafka stop
Property | Value |
---|---|
ZooKeeper connection | localhost:2181 |
Kafka bootstrap servers | localhost:9092 |
Kafka consumer group Id | kafka-consumer-group |
Kafka broker id | 0 |
Number of partitions | 1 |
Data log file retention period | 168 hours |
Enable auto topic creation | false |
Enable topic deletion | true |
Port | Description |
---|---|
9092 | Kafka listener port |
Directory / File | |
---|---|
Kafka installation directory (symlink to installed version) | /opt/kafka |
Kafka configuration directory (symlink to /opt/kafka/config) | /etc/kafka |
Directory to store data files | /var/lib/kafka/logs |
Kafka service | /usr/lib/systemd/system/kafka.service |