Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to install, configure and use Kafka

Shulou Source: shulou.com Published: 2022-06-01 02:06:31 10月01日 Update

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!

Tags: Configuration logs directories articles basics at the same time data files external special hosts topics values information interests distribution parameters meaning more friends Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Xiaomi Shulou Tech Info Linux vpn