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

Install kafka under Linux

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Precondition

Zookeeper must be installed. Linux install zookeeper

Kafka official source

Kafka official website download page

Download the kafka installation package # version: kafka_2.11-2.3.0.tgzwget http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/2.3.0/kafka_2.11-2.3.0.tgz

Extract the installation package tar-zxvf kafka_2.11-2.3.0.tgzcp kafka_2.11-2.3.0 / usr/local/kafka

Start the kafka service cd / usr/local/kafka/bin# startup command: the daemon starts. / kafka-server-start.sh-daemon.. / config/server.properties

Note: an error may be reported here, because by default, the default memory of kafka is 1 gigabyte, and if you don't have so much memory available, it will fail to start. The error is as follows:

Java Hotspot (TM) 64-Bit Server VM warning: INFO: os::commit_memory (0x00000000c5330000, 986513408, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue.# Native memory allocation (malloc) failed to allocate 986513408 bytes for committing reserved memory.# An error report file with more information is saved as:# hs_err_pid5535.log

Solution:

Modify the startup script: kafka-server-start.shvim kafka-server-start.sh

The content of the setting is set according to your own situation.

Create a chart named test for topic#, with only one copy, and a partition kafka-topics.sh-- create-- zookeeper localhost:2181-- replication-factor 1-- partitions 1-- topic chart# to view the topickafka-topics.sh-list-zookeeper localhost:2181 of kafka

Production and consumption testing # start the production side. / kafka-console-producer.sh-- broker-list localhost:9092-- topic chart# start the consumer side. / kafka-console-consumer.sh-- bootstrap-server localhost:9092-- topic chart-- from-beginning

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

Internet Technology

Wechat

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

12
Report