Ubuntu虛擬機器 Zookeeper+Kafka叢集搭建
阿新 • • 發佈:2018-12-13
機器和環境
三臺ubuntu 16.04 64bit
ip地址 | zookeeper主從 | kafka broker id |
---|---|---|
172.16.227.128 | follower | 1 |
172.16.227.129 | leader | 2 |
172.16.227.130 | follower | 3 |
- jdk 1.8
- kafka_2.11-1.1.0
- zookeeper-3.4.12/
172.16.227.128的配置包括如下(同理其它兩臺機器)
- /opt/zookeeper/zookeeper-3.4.12/conf/zoo.cfg
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/opt/zookeeper/data
dataLogDir=/opt/zookeeper/log
# the port at which the clients will connect
clientPort=2181
server.1=172.16.227.128:2888:3888
server.2=172.16.227.129:2888:3888
server.3=172.16.227.130:2888:3888
- /opt/zookeeper/data/myid (對應
server.1
)
1
- /opt/kafka_2.11-1.1.0/config/ server.properties
# The id of the broker. This must be set to a unique integer for each broker.
broker.id=1
hostname.name=172.16.227.128
port=9092
advertised.host.name=172.16.227.128
advertised.port=9092
zookeeper.connect=172.16.227.128:2181,172.16.227.129:2182,172.16.227.130:2181