Kafka1:kafka Cluster Deployment steps Reference: Http://www.cnblogs.com/myparamita/p/5219487.htmlKafka cluster--3 broker 3 Zookeeper Create a real combat kafka_kafka introduction and installation _v1.3 http://www.docin.com/p-1291437890.html
I. Preparatory work:1. Prepare 3 machines with IP addresses of: 192.168.3.230 (233,234) 2 respectively. Download Kafka stable version, my version is: Scala 2.11-kafka_2.11-0.9.0.0.tgz http://kafka.apache.org/downloads.html 3. respectively extracted into the directory you want to install, my directory is:/home/rasa decompression command: TAR-XZF *.tgz
second, build zookeeper cluster1. Enter the extracted directory/home/rasa/kafka_2.11-0.9.0.0 2. Go to config directory and modify the Zookeeper.properties file (same as all machines) ticktime
=DataDir
=/data/zookeeper/clientport
=2181 Initlimit
=5 Synclimit
=2 Server.1
=192.168.3.230:2888:3888 Server.2
=192.168.3.233:2888:3888 SERVER.3
=192.168.3.234:2888:3888 3. Write a myID file under the DataDir directory/data/zookeeper/, with the following command: Echo 1 >myid Note: This ID is zookeep ER host flag, each host ID is different second station is 2 third is 3. 4. The zookeeper of 3 machines is formed a cluster: > bin/zookeeper-server-start.sh config/zookeeper.properties & due to Zookee When the per cluster is started, each node tries to connect to the other nodes in the cluster, and the first boot must not be connected to the back, so the printed part of the exception is negligible. After selecting a leader, the cluster finally stabilized. Other nodes may also appear to have similar problems, which belong to normal.
third, build Kafka cluster1. Go to config directory and modify server.properties (machine-by-device modification) broker.id
=1 (Other machine for 2/3) port
=9092 Zookeeper.connect
=192.168.3.230:2181,192.168.3.233:2181,192.168.3.234:2181 Log.dirs
=/home/rasa/kafka-logs Host.name
=192.168.3.230 Advertised.host.name
=192.168.3.230 2. Start Kafka for each server: > bin/kafka-server-start.sh config/server.properties &
iv. test Clusters 1. Create a topic > bin/kafka-topics.sh--create--zookeeper 192.168.3.230:2181-- Replication-factor 3--partitions 1 --topic test-topic 2. View Created topic > bin/kafka-topics.sh--describe--zookeeper 192.168.3.230:2181--topic Test-topi C topic:test-replicated-topic partitioncount:1 Replic ationfactor:3 configs: topic:test-replicated-topic Pa rtition:0 leader:1 replicas:1,2,0 isr:1,2,0 3. View Topi C List > bin/kafka-topics.sh--list--zookeeper 192.168.3.230:2181 test Test-topic View list and specific information > bin/kafka-topics.sh--zookeeper localhost--describe 4. ViewCluster Status: >bin/kafka-topics.sh--describe--zookeeper 192.168.3.233:2181--topic test-topic &n Bsp >bin/kafka-topics.sh--describe--zookeeper 192.168.3.234:2181--topic test-topic & nbsp found that test-topic can be seen. 5. Production messages > bin/ kafka-console-producer.sh--broker-list 192.168.3.234:9092-topic test-topic 6. Consumer News & nbsp > bin/kafka-console-consumer.sh--zookeeper 192.168.3.234:2181--from-beginning--topic Test-topic & nbsp
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.