Kafka--linux Environment Construction

Source: Internet
Author: User
Tags unique id zookeeper

1.JDK 1.8

2.zookeeper 3.4.8 Decompression

3.kafka Configuration
In the Kafka decompression directory under a config folder, which is placed in our configuration file

Consumer.properites consumer configuration, this profile is used to configure the consumers opened in section 2.5, where we use the default

Producer.properties producer configuration, this configuration file is used to configure the producers opened in section 2.5, where we use the default

Server.properties Kafka Server configuration, this profile is used to configure the Kafka server, currently only a few of the most basic configuration

      1. Broker.id affirms that the unique ID of the current Kafka server in the cluster needs to be configured as an integer, and that the ID of each Kafka server in the cluster should be unique, we use the default configuration here
      2. Listeners declare this Kafka server needs to listen to the port number, if it is running on the local virtual machine run can not configure this item, the default will use the address of localhost, if it is run on a remote server must be configured, for example:

listeners=plaintext://192.168.180.128:9092. And make sure that port 9092 of the server can access

3.zookeeper.connect Kafka the address of the zookeeper to be connected, the address that needs to be configured to zookeeper, because this time uses Kafka high version comes with the zookeeper, uses the default configuration to

zookeeper.connect=localhost:2181

4. Run Zookeeper I am the start command to the Zookeeper Bin directory: SH zkservwer.sh start

5. Start Kafka

Because it is not a cluster, it is the default configuration Kafka boot command: To Kafka bin./bin/kafka-server-start.sh config/server.properties success is as follows:

6.topic Test

1) In Kafka Unzip directory open terminal, enter

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

    创建一个名为test的topic

2) See if the creation was successful

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

3)创建一个消息消费者

   在kafka解压目录打开终端,输入

    bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test--from-beginning

   可以创建一个用于消费topic为test的消费者 此时相当于一个控制台 不会有任何输出

4) Create a message producer

In the Kafka unzip directory open a new terminal, enter

    bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

5) Consumption output:

This article refers to the blog address: https://www.cnblogs.com/hei12138/p/7805475.html

Kafka--linux Environment Construction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.