kafka集群部署
Posted 且穷且独立
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了kafka集群部署相关的知识,希望对你有一定的参考价值。
1) 每台机器配置如下:
$ cat /etc/hosts
...
# zookeeper hostnames:
192.168.8.182 zk1
192.168.8.183 zk2
192.168.8.184 zk3
2) 每台机器上安装jdk, zookeeper, kafka, 配置如下:
$ vi /etc/profile
...
# jdk, zookeeper, kafka
export KAFKA_HOME=/usr/local/lib/kafka/kafka_2.9.2-0.8.11
export ZK_HOME=/usr/local/lib/zookeeper/zookeeper-3.4.6
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$KAFKA_HOME/bin:$ZK_HOME/bin:$PATH
3) 每台机器上运行:
$ 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 connect
clientPort=2181
# zookeeper cluster
server.1=zk1:2888:3888
server.2=zk2:2888:3888
server.3=zk3:2888:3888
4) 每台机器上生成myid:
zk1:
$ echo "1" > /var/lib/zookeeper/myid
zk2:
$ echo "2" > /var/lib/zookeeper/myid
zk3:
$ echo "3" > /var/lib/zookeeper/myid
以上是关于kafka集群部署的主要内容,如果未能解决你的问题,请参考以下文章