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 for CentOS7

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces how to install Kafka in CentOS7, which is very detailed and has certain reference value. Friends who are interested must finish reading it!

Brief introduction

Kafka is a high throughput distributed publish and subscribe message system, which can replace the traditional message queue for uncoupling data processing, caching unprocessed messages, etc., and has higher throughput, supporting partitioning, multiple replicas and redundancy, so it is widely used in large-scale message data processing applications.

Kafka supports Java and many other language clients, and can be used in conjunction with other big data tools such as Hadoop, Storm, Spark, and so on.

This tutorial focuses on the installation and use of Kafka on Centos 7, including functional verification and simple configuration of the cluster.

Install JDK

Kafka uses Zookeeper to save relevant configuration information. Kafka and Zookeeper rely on the Java running environment. Download the JDK installation package from the oracle website and extract the installation:

$tar zxvf jdk-8u65-linux-x64.tar.gz$mv jdk1.8.0_65 java

Set the Java environment variable:

JAVA_HOME=/opt/javaPATH=$PATH:$JAVA_HOME/binexport JAVA_HOME PATH

You can also select the yum install installation and set the environment variables accordingly.

Install Kafka

Download the Kafka installation package from the official website, decompress and install: official website address: http://kafka.apache.org/downloads.html

Tar zxvf kafka_2.11-0.8.2.2.tgzmv kafka_2.11-0.8.2.2 kafkacd kafka

Functional verification

1. Start Zookeeper use the script in the installation package to start a single-node Zookeeper instance:

Bin/zookeeper-server-start.sh-daemon config/zookeeper.properties

two。 Start the Kafka service using kafka-server-start.sh to start the kafka service:

Bin/kafka-server-start.sh config/server.properties

3. Create topic use kafka-topics.sh to create a single partition single copy of the topic test:

Bin/kafka-topics.sh-create-zookeeper localhost:2181-replication-factor 1-partitions 1-topic test

View topic:

Bin/kafka-topics.sh-list-zookeeper localhost:2181test

4. Generate a message and use kafka-console-producer.sh to send a message:

Bin/kafka-console-producer.sh-broker-list localhost:9092-topic test Hello world!

5. Consumer messages use kafka-console-consumer.sh to receive messages and print them on the terminal:

Bin/kafka-console-consumer.sh-zookeeper localhost:2181-topic test-from-beginning

The messages generated by producer are synchronized with the messages consumed by consumer.

The above is all the contents of the article "how to install Kafka in CentOS7". Thank you for reading! Hope to share the content to help you, more related 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

Servers

Wechat

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

12
Report