1. Download the latest Kafka from Kafka website, current version is 0.9.0.1
2. After downloading, upload to the Linux server and unzip
Tar-xzf kafka_2.11-0.9.0.1.tgz
3. Modify the Zookeeper server configuration and start
CD Kafka_2.11-0.9.0.1vi config/zookeeper.properties #修改ZooKeeper的数据目录dataDir =/opt/favccxx/db/zookeeper# Configure Host.name and Advertised.host.name as IP addresses to prevent parsing to localhosthost.name=10.0.10.6advertised.host.name= when connecting through a Java client 10.0.10.6# start the zookeeper server./zookeeper-server-start.sh/opt/favccxx/kafka_2.11-0.9.0.1/config/zookeeper.properties
4. Modify the Kafka configuration and start the Kafka server
VI config/server.properties log.dirs=/opt/favccxx/kafka/kafka-logs# start the Kafka server./kafka-server-start.sh/opt/favccxx /kafka_2.11-0.9.0.1/config/server.properties
5. Create and view topic
cd/opt/favccxx/kafka_2.11-0.9.0.1/bin/./kafka-topics.sh--create--zookeeper localhost:2181--replication-factor 1- -partitions 1--topic testcreated topic "Test". #查看刚才的topic./kafka-topics.sh--list--zookeeper localhost:2181test
6. Use the producer to send messages, each line is a separate message
./kafka-console-producer.sh--broker-list localhost:9092--topic Testthis is a messagethis is My mesage
7. Using consumers to receive messages
./kafka-console-consumer.sh--zookeeper localhost:2181--topic Test--from-beginningthis is a messageThis is My me
This article is from the "This person's IT World" blog, be sure to keep this source http://favccxx.blog.51cto.com/2890523/1761663
Linux under Install and (single node) configuration boot Kafka