Home >System Tutorial >LINUX >Quick guide to install Kafka on Linux
Title: Linux Kafka Installation Tutorial: Getting Started Quickly
Text:
1. Preface
Apache Kafka is a distributed publish-subscribe messaging system that can handle large amounts of data and provide high throughput, low latency, and high reliability. Kafka is widely used in log collection, data analysis, stream processing and other fields.
2. Installation preparation
3. Install ZooKeeper
Configure ZooKeeper: Find the conf/zoo.cfg
file in the decompressed ZooKeeper directory, and modify the following configuration:
dataDir=/path/to/zookeeper/data
: ZooKeeper data directory clientPort=2181
: ZooKeeper client port bin/zkServer.sh start
4. Install Kafka
Configure Kafka: Find the config/server.properties
file in the decompressed Kafka directory, and modify the following configuration:
broker.id=0
: Kafka broker IDzookeeper.connect=localhost:2181
: ZooKeeper connection address log.dirs=/path /to/kafka/logs
: Kafka log directorybin/kafka-server-start.sh config/server.properties
5. Create Topic
bin/kafka-console-producer.sh --topic my-topic
create my-topic --replication-factor 1 --partitions 1
6. Send a message
send my-topic hello world
7. Receive messages
bin/kafka-console-consumer.sh --topic my-topic --from-beginning
8. Stop Kafka
bin/kafka-server-stop.sh
bin/zkServer.sh stop
9. Summary
Through the above steps, you have successfully installed Kafka on Linux. Now you can start using Kafka to process your data.
The above is the detailed content of Quick guide to install Kafka on Linux. For more information, please follow other related articles on the PHP Chinese website!