kafka集群部署

1.安装好zookeeper集群

2.下载kafaka安装包,上传到服务器并解压

wget https://archive.apache.org/dist/kafka/0.8.2.2/kafka_2.11-0.8.2.2.tgz
scp kafka_2.11-0.8.2.2.tgz mini1:/root/apps/
tar -zxvf /kafka_2.11-0.8.2.2.tgz -C install
mv /kafka_2.11-0.8.2.2 kafka

3.配置环境变量

vim /etc/profile
export KAFKA_HOME=/root/apps/install/kafka
export PATH=$PATH:$KAFKA_HOME/bin

4.修改配置文件

改三处,分别是broker_id,log_dirs,host.name以及zookeeper地址

vim /root/apps/install/kafka/config/server.properties


############################# Server Basics #############################
#每台机器的brocker.id要不同
broker.id=0

############################# Socket Server Settings #############################

port=9092

#host.name=localhost

num.network.threads=2

num.io.threads=2

socket.send.buffer.bytes=1048576

socket.receive.buffer.bytes=1048576

socket.request.max.bytes=104857600


############################# Log Basics #############################

#自定义一个日志目录
log.dirs=/root/apps/install/kafka/kafka-logs

num.partitions=2

############################# Log Flush Policy #############################
log.flush.interval.messages=10000

log.flush.interval.ms=1000

############################# Log Retention Policy #############################

log.retention.hours=168

#log.retention.bytes=1073741824

log.segment.bytes=536870912

log.cleanup.interval.mins=1

############################# Zookeeper #############################
#zookeeper集群地址
zookeeper.connect=mini1:2181,mini2:2181,mini3:2181

zookeeper.connection.timeout.ms=1000000

host.name=localhost

5.分发

scp -r kafka mini2:/root/apps/install/
scp -r kafka mini3:/root/apps/install/ 
scp -r kafka mini4:/root/apps/install/

scp /etc/profile mini2:/etc/
source /etc/profile
scp /etc/profile mini3:/etc/
source /etc/profile
scp /etc/profile mini4:/etc/
source /etc/profile

6.启动与关闭

#启动
kafka-server-start.sh /root/apps/install/kafka/config/server.properties &

#关闭
pkill -9 -f server.properties
posted @ 2018-06-13 21:20  py小杰  阅读(651)  评论(0编辑  收藏  举报