Install and test Kafka under CentOS

Source: Internet
Author: User

System Centos6.5

Tool SECURECRT

1. First download the Kafka compression pack

Kafka_2.9.2-0.8.1.1.tgz

Extract

TAR-ZXVF kafka_2.9.2-0.8.1.1.tgz

2. Modify the configuration file

First to have zookeeper, install zookeeper step in another essay http://www.cnblogs.com/yovela/p/5178210.html

Learn a new command: CD XXXX && ls to go to the same time to view the file directory

2.1. Modify Zookeeper.properties

VI config/zookeeper.properties

Datadir=/usr/program/zoopkeeper/zookeeper-3.4.5/tmp
clientport=2181
Maxclientcnxns=0

Basic modification DataDir on it, the others do not change, do not remember to come back to see

2.2. Modify Server.properties

VI server.properties

Host.name=ip

Log.dirs=/usr/program/kafka/kafka_2.9.2-0.8.1.1/kafka-logs

Basically, you can change these two.

2.3. Modify/etc/hosts

If you report unknownhostexception, you can change this place.

Vi/etc/hosts

At the bottom, add

IP user Name

IP is the host IP and the user name is the one followed by the @ sign

3. Start and test

3.1 Starting the Zookeeper service

Under the Kafka directory

[Email protected] kafka_2.9.2-0.8.1.1]# bin/zookeeper-server-start.sh config/zookeeper.properties &

Enter after waiting for it to run, press ENTER can, at this time with JPS view, you can see Quorumpeermain, explain zookeeper start good

3.2 Starting the Kafka service

[Email protected] kafka_2.9.2-0.8.1.1]# bin/kafka-server-start.sh config/server.properties &

Enter after it ran (there will be two times output, wait a moment), press ENTER can, at this time with JPS view, you can see Kafka, explain Kafka start good

3.3 Creating topic

bin/kafka-topics.sh--zookeeper bogon:2181--topic mytopic--replication-factor 1--partitions 1--create

Bogon is my host name, Mytopic is topic name.

Wait a moment after carriage return

At the end of the day, an info Closing socket connection toxxxxxxx

Don't panic, it's normal.

3.4

See just new Topic

bin/kafka-topics.sh--zookeeper bogon:2181--list

Output as above, in the middle of the list, at first did not notice, then thought wrong ....

3.5 Running producer

Enter Hello Kafka and press Enter

bin/kafka-console-producer.sh--broker-list bogon:9092--topic mytopic
Hello Kafka

3.6 Running Customer

SecureCRT a new session, connected to this service, also into the Kafka directory

bin/kafka-console-consumer.sh--zookeeper bogon:2181--topic mytopic--from-beginning

You can see just the Hello Kafka after the carriage return

PS: Exception Handling

Report exception:

Failed to load Class "Org.slf4j.impl.StaticLoggerBinder"

Workaround:

Download Slf4j-1.7.6.zip
wget Http://www.slf4j.org/dist/slf4j-1.7.6.zip

Extract
Unzip Slf4j-1.7.6.zip

Copy the Slf4j-nop-1.7.6.jar package to the Kafka Libs directory

Finally, delete the topic

This I have not solved, log deleted, command also played, also restarted, is deleted, follow this tutorial to do, also is list to be deleted topic, have resolved the small partner can tell me ha, http://www.aboutyun.com/blog-1415-887.html

Recommended Tutorials URL:

1.http://www.cnblogs.com/oftenlin/p/4047504.html

2.http://www.cnblogs.com/sunxucool/p/4459020.html

Install and test Kafka under CentOS

Related Article

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.