Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Kafka on Linux system

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to install Kafka Linux system, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to understand it!

Kafka is a high-throughput distributed publish and subscribe messaging system, which can handle all the action flow data of consumers in the website.

Introduction to Kafka: Kafka is a distributed message queue. ★ Kafka classifies messages according to Topic when they are saved. The sender is called Producer and the message recipient is called Consumer. In addition, the kafka cluster is composed of multiple kafka instances, and each instance (server) is called broker. Both kafka cluster and consumer rely on zookeeper cluster to store some meta information to ensure system availability.

Linux system installation Kafka specific steps: Kafka download official website download address http://kafka.apache.org/downloads demo version https://archive.apache.org/dist/kafka/1.0.0/kafka_2.12-1.0.0.tgz

Extract to tar-zxvf kafka_2.12-1.0.0.tgz mv kafka_2.12-1 / usr/local/kafka in the installation directory

Configure # to create a log storage directory. By default, when Kafka runs, many log files, such as server.log, controller.log, state-change.log, etc., will be printed through log4j, and will be output to the $KAFKA_HOME/logs directory. This is not conducive to online operation and maintenance, because it is often easy to break the file system.

# here we point the log directory to cd / var/local mkdir-p kafka-logs # modify the configuration file / opt/kafka/config/server.properties vi / usr/local/kafka/config/server.properties # and mainly modify the following: broker.id=181 delete.topic.enable=true listeners = PLAINTEXT://192.168.0.166:9092 log.dirs=/var/local/kafka-logs zookeeper.connect=127.0.0.1:2181

Add the system environment variable vi / etc/profile # and add the following:

KAFKA_HOME=/usr/local/kafka PATH=KAFKA_HOME/bin export PATH KAFKA_HOME

Launch and test kafka-server-start.sh / usr/local/kafka/config/server.properties # send. / kafka-console-producer.sh-broker-list 192.168.0.166 broker-list 9092-topic test1 # receive. / kafka-console-consumer.sh-zookeeper 192.168.0.166 kafka-console-producer.sh-topic test1-from-beginning

Boot # create a kafka script file under init.d

Cd / etc/rc.d/init.d touch kafka vi kafka# edits the following

#! / bin/bash

# chkconfig:2345 30 80 # description:kafka # processname:kafka export JAVA_HOME=/usr/local/jvm/jdk1.8.0_201 export KAFKA_HOME=/usr/local/kafka case {KAFKA_HOME} / bin/kafka-server-start.sh-daemon {KAFKA_HOME} / bin/kafka-server-stop.sh;; status) jps;; restart) {KAFKA_HOME} / bin/kafka-server-start.sh-daemon ${KAFKA_HOME} / config/server.properties;; *) echo "require start | stop | status | restart";; esac # permission

Chmod 755 kafka # Test the addition of service kafka start # to the service list chkconfig-- add kafka chkconfig-- the pit Kafka process encountered by list chkconfig kafka on always stops using kafka-server-start.sh-daemon / usr/local/kafka/config/server.properties automatically after starting for a period of time-the daemon daemon starts

The above is all the contents of the article "how to install Kafka in Linux system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report