Zookeeper + kafka cluster Installation
Prepare three VMS. The system is RHEL64.
1) the configuration of each machine is as follows:
$ Cat/etc/hosts
...# zookeeper hostnames:192.168.8.182 zk1192.168.8.183 zk2192.168.8.184 zk3
2) install jdk, zookeeper, and kafka on each machine. The configuration is as follows:
$ Vi/etc/profile
...# jdk, zookeeper, kafkaexport KAFKA_HOME=/usr/local/lib/kafka/kafka_2.9.2-0.8.11export ZK_HOME=/usr/local/lib/zookeeper/zookeeper-3.4.6export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jarexport PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$KAFKA_HOME/bin:$ZK_HOME/bin:$PATH
3) run on each machine:
$ Source/etc/profile
$ Mkdir-p/var/lib/zookeeper
$ Cd $ ZK_HOME/conf
$ Cp zoo_sample.cfg zoo. cfg
$ Vi zoo. cfg
...dataDir=/var/lib/zookeeper# the port at which the clients will connectclientPort=2181# zookeeper clusterserver.1=zk1:2888:3888server.2=zk2:2888:3888server.3=zk3:2888:3888
4) generate the myid on each machine:
Zk1:
$ Echo "1">/var/lib/zookeeper/myid
Zk2:
$ Echo "2">/var/lib/zookeeper/myid
Zk3:
$ Echo "3">/var/lib/zookeeper/myid
5) run setup on each machine to close the Firewall
Firewall:
[] Enabled
6) Start zookeeper on each machine:
$ ZkServer. sh start
View status:
$ ZkServer. sh status