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 use the three servers installed with zookeeper to do KAFKA cluster

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how to use the three servers installed with zookeeper to do KAFKA cluster, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.

First, use the three servers that install zookeeper to do KAFKA cluster.

Server

IP address

Port

Server 1

10.211.55.7

9092

Server 2

10.211.55.8

9092

Server 3

10.211.55.9

9092

Download kafka_2.9.2-0.8.1

Download address: https://archive.apache.org/dist/kafka/0.8.1/kafka_2.9.2-0.8.1.tgz

Create kafka directories on each of the three servers and download the kafka package

# mkdir / usr/local/kafka

# tar-zxvf kafka_2.9.2-0.8.1.tar.gz

1.2 create a log folder

# mkdir / usr/local/kafka/kafkalogs

1.3Configuring kafka

# cd / usr/local/kafka/kafka_2.9.2-0.8.1/config

# vi server.properties modifications are as follows:

Broker.id=0 / / the unique identity of the current machine in the cluster

Port=9092 / / tcp port on which kafka provides services

Host.name=10.211.55.7 / / Host IP address

Log.dirs=/usr/local/kafka/kafkalogs / / log storage directory

Message.max.byte=5048576 / / kafka what is the maximum number of messages a message can hold

Default.replication.factor=2 / / default number of copies per partition

Replica.fetch.max.bytes=5048576

Zookeeper.connect=10.211.55.7:2181, 10.211.55.8:2181, 10.211.55.9:2181

4.4 start kafka

#. / kafka-server-start.sh-daemon.. / config/server.properties / / start running at the background

4.5 problem solving

[root@master] # / export/kafka/bin/kafka-console-producer.sh-- broker-list 10.14.2.201 broker-list 9092 topic test 10.14.2.202 topic test

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

SLF4J: Defaulting to no-operation (NOP) logger implementation

SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

# / export/kafka/bin/kafka-console-consumer.sh-- zookeeper 10.14.2.201 topic test 2181-- topic test-- from-beginning

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

SLF4J: Defaulting to no-operation (NOP) logger implementation

SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Solution:

Download slf4j-1.7.6.zip

Http://www.slf4j.org/dist/slf4j-1.7.6.zip

Decompression

Unzip slf4j-1.7.6.zip

Copy the slf4j-nop-1.7.6.jar package to the kafka libs directory

Cd slf4j-1.7.6

Cp slf4j-nop-1.7.6.jar / export/kafka/libs/

II. KAFKA cluster verification

2.1Create topic

#. / kafka-topics.sh-- create-- zookeeper 10.211.55.7 zookeeper 2181-- replication-factor 1-- partitions 1-- topic test

2.2 View topic

#. / kafka-topics.sh-- list-- zookeeper 10.211.55.7VR 2181

2.3 Open the sender and send a message

#. / kafka-console-producer.sh-- broker-list 10.211.55.7-- topic test

2.4 Open consumers and receive messages

#. / kafka-console-consumer.sh-- zookeeper 10.211.55.8-- topic test-- from-beginning

Thank you for reading this article carefully. I hope the article "how to use the three servers installed with zookeeper to do KAFKA cluster" shared by the editor will be helpful to everyone. At the same time, I also hope that 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

Development

Wechat

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

12
Report