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, configure and use Kafka

2025-01-16 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, configure and basic use of Kafka, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.

11. Kafka

This topic describes the installation, configuration, and basic use of Kafka.

Kafka basic Information

Official website: http://kafka.apache.org/11.1. Environment preparation # switch to workspace cd / opt/workspaces# to create Kafka data directory mkdir data/kafka# create Kafka log directory mkdir logs/kafka11.2. Install wget http://mirrors.cnnic.cn/apache/kafka/0.8.2.2/kafka_2.10-0.8.2.2.tgztar-zxf kafka_2.10-0.8.2.2.tgzrm-rf kafka_2.10-0.8.2.2.tgzmv kafka_2.10-0.8.2.2. / frameworks/kafka11.3. Configuration (pseudo-distributed)

Vi. / frameworks/kafka/config/server.properties

# set the following parameters: broker.id=0port=9092# external hostname advertised.host.name=# data directory log.dirs=/opt/workspaces/data/kafka# connection ZKzookeeper.connect=localhost:2181

When you have multiple network cards or use special network settings to cause the IP used when Kafka starts to differ from the exposed IP, you need to specify advertised.host.name as the public network IP you expect to use.

Log.dirs is interpreted as A comma seperated list of directories under which to store log files. Here, the so-called log file refers to the message persistence file of Kafka, not the run log in the general sense.

Vi. / frameworks/kafka/config/log4j.properties

# set the log directory kafka.logs.dir=/opt/workspaces/logs/kafka11.4. Start and stop nohup. / frameworks/kafka/bin/kafka-server-start.sh. / frameworks/kafka/config/server.properties > / dev/null 2 > & 1 & 11.5. Test. / frameworks/kafka/bin/kafka-topics.sh-- create-- zookeeper localhost:2181-- replication-factor 1-- partitions 1-- topic test./frameworks/kafka/bin/kafka-console-producer.sh-- broker-list localhost:9092-- topic test > This is a message > This is another message# enter in another window. / frameworks/kafka/bin/kafka-console-consumer.sh-- zookeeper localhost:2181-- topic test-- from-beginning > This is a message > This is another message Thank you for reading this article carefully. I hope the article "how to install, configure and use Kafka" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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