zookeeper
1.三节点执行
 tar -zxvf zookeeper-3.4.6.tar.gz -C /usr/local/
2.三节点执行
[root@localhost opt]# cd /usr/local/zookeeper-3.4.6/
[root@localhost zookeeper-3.4.6]# mkdir -p zkdata
[root@localhost zookeeper-3.4.6]# mkdir -p zkdatalog
3.修改配置文件,三节点执行
[root@kafka2 conf]# vi 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=/usr/local/zookeeper-3.4.6/zkdata
dataLogDir=/usr/local/zookeeper-3.4.6/zkdatalog
# the port at which the clients will connect
clientPort=2181
server.1=IP1:2888:3888
server.2=IP2:2888:3888
server.3=IP3:2888:3888
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

# 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=/usr/local/zookeeper-3.4.6/zkdata
dataLogDir=/usr/local/zookeeper-3.4.6/zkdatalog
# the port at which the clients will connect
clientPort=2181
server.1=IP1:2888:3888
server.2=IP2:2888:3888
server.3=IP3:2888:3888
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

4.节点1
[root@localhost zookeeper-3.4.6]# echo '1' > zkdata/myid
节点2
[root@localhost zookeeper-3.4.6]# echo '2' > zkdata/myid
节点3
[root@localhost zookeeper-3.4.6]# echo '1' > zkdata/myid
5.起zookeper进程,三节点执行
[root@kafka1 ~]# cd /usr/local/zookeeper-3.4.6/bin/
[root@kafka1 bin]# ./zkServer.sh start


kafka
6.三节点执行
[root@kafka3 opt]# tar -zxvf kafka_2.11-1.0.0.tgz 
[root@kafka1 kafka_2.11-1.0.0]# mkdir -p kdata
7.修改配置文件,三节点执行,其他信息一致,根据自己实际环境更改,这里只更改了必要的几个。broker.id三节点不能重复,zookeeper.connect写ip和主机名都可以
[root@kafka2 config]# vi server.properties 
broker.id=1 #节点1
broker.id=2 #节点2
broker.id=3 #节点3
listeners=PLAINTEXT://:9092
log.dirs=/opt/kafka_2.11-1.0.0/kdata
zookeeper.connect=kafka1:2181,kafka2:2181,kafka3:2181

8.后台启动启动kafka进程
[root@kafka1 kafka_2.11-1.0.0]# bin/kafka-server-start.sh -daemon config/server.properties &

 

posted on 2019-05-24 10:04  Tomatoes  阅读(844)  评论(0编辑  收藏  举报