1, preparation work 1.1, machine preparation
server1:10.40.33.11server2:10.40.33.12server3:10.40.33.13
1.2, port occupancy situation
zookeeper:2181,3888,4888kafka:9092
1.3. Software Preparation
JDK1.7.0_51 (latest version of kafka-0.8.2.1 recommended to use 1.7 and later versions of JDK) zookeeper3.4.5 (and above) kafka_2.11-0.8.2.1 (latest version)
2, installation 2.1, installation zookeeper
1. Download zookeeper :http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.6/ zookeeper-3.4.6.tar.gz2. Install Zookeeper server1,server2,server3 perform a,b,c steps separately. assume that the installation directory is: $ZOOKEEPER _home=/home/sinova/zookeeper-3.4.6 a. Decompression tar -zxvf zookeeper-3.4.6.tar.gz B. Configure copy conf/zoo_sample.cfg copies to Zoo.cfg, also placed in conf directory. Then modify the configuration in the following values: ticktime=2000 initLimit=10 syncLimit=5 dataDir=/disk0/var/zookeeper/datas datalogdir=/disk0/var/zookeeper/logs clientport=2181 server.1=10.40.33.11:3888:4888 server.2=10.40.33.12:3888:4888 server.3=10.40.33.13:3888:4888 c. Creating myID Files Command: cd datadir (/disk0/var/zookeeper/datas) echo 1 > myid Note: 1 is the value of myID in the Id,serverx of the zookeeper instance. 3. Start the Server1,server2,server3 Zookeeper Instance Start command in turn: $ZOOKEEPER _home/bin/zkserver.sh start Stop command: $ZOOKEEPER _home/bin/zkserver.sh  STOP4. Test zookeeper is working correctly, execute the following command on Server1 a.jps see if there is a quorumpeermain process &Nbsp;b. $ZOOKEEPER _home/bin/zkcli.sh -server 192.168.0.2:2181
Installing Kafka
1. Download kafka :http://mirror.bit.edu.cn/apache/kafka/0.8.2.1/kafka_2.11-0.8.2.1. tgz2. Install Kafka server1,server2,server3 perform a A/b step, respectively. assume that the installation directory is: $KAFKA _home=/home/sinova/kafka_2.11-0.8.2.1 a. Decompression tar -zxvf kafka_2.11-0.8.2.1.tgz B. Configure Modify the $kafka_home/conf/server.properties. config file and modify it as follows. broker.id=0# guarantee that the ID is unique in the cluster port=9092 num.network.threads=2 num.io.threads=8 socket.send.buffer.bytes=1048576 socket.receive.buffer.bytes=1048576 socket.request.max.bytes=104857600 log.dirs=/disk0/var/kafka/logs# ensure that the directory exists num.partitions=2 log.retention.hours=168 log.segment.bytes=536870912 log.retention.check.interval.ms=60000 zookeeper.connect= 10.40.33.11:2181,10.40.33.12:2181,10.40.33.13:2181/kafka log.cleaner.enable=false zookeeper.connection.timeout.ms=1000000 delete.topic.enable=true queue.buffering.max.ms=5000ms queue.buffering.max.message=5000 Note: Broker.id is the x value in the Serverx, which guarantees the unique in the cluster. 3. Start Server1,server2,server3 Kafka Instance start command in turn: cd $KAFKA _home nohup bin/kafka-server-start.sh config/server.properties & Stop Command: cd $KAFKA _home bin/ Kafka-server-stop.sh4. Test whether the zookeeper is working correctly, execute the following command on Server1 a.jps see if there is a Kafka process b. Test Create topic command: cd $ kafka_home bin/kafka-topics.sh --create --zookeeper 10.40.33.11:2181,10.40.33.12:2181,10.40.33.13:2181/kafka --replication-factor 1 --partitions 1 --topic test
This article is from the "Patrick" blog, so be sure to keep this source http://patrick0715.blog.51cto.com/3681259/1827451
Installing Zookeeper+kafka