一.首先需要java的坏境
1、安装java环境
rpm -ivh jdk-8u151-linux-x64.rpm
2、配置java环境变量
export JAVA_HOME=/usr/java/jdk1.8.0_151
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
二.安装zookeeper
要运行kafka需要先启动zookeeper
1、安装zookeeper
tar -xf apache-zookeeper-3.7.1-bin.tar.gz
mv apache-zookeeper-3.7.1-bin /usr/local/zookeeper
2.zookeeper配置文件
创建数据目录
mkdir /data/zookeeper
配置文件
/usr/local/zookeeper/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/data/zookeeper
clientPort=2181
maxClientCnxns=60
autopurge.snapRetainCount=3
autopurge.purgeInterval=1
3.配置集群
添加配置文件
/usr/local/zookeeper/conf/zoo.cfg
server.1=host.nam:2888:3888
server.2=host.name:2888:3888
server.3=host.name:2888:3888
生成id文件
echo "num" > /data/zookeeper/myid
4.zookeeper服务项
启动:/usr/local/zookeeper/bin/zkServer.sh strat
关闭:/usr/local/zookeeper/bin/zkServer.sh stop
三.安装Kafka
1.安装Kafka
tar -xf kafka_2.12-2.8.2.tgz
mv kafka_2.12-2.8.2 /usr/local/kafka
2.配置文件
创建数据目录
mkdir /data/kafka
配置文件
/usr/local/kafka/config/server.properties
broker.id=0 #(id)
listeners=PLAINTEXT://localhost:9092
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
log.dirs=/data/kafka
num.partitions=1
num.recovery.threads.per.data.dir=1
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1
log.retention.hours=168
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
zookeeper.connect=zookeeper1:2181,zookeeper2:2181,zookeeper3:2181
zookeeper.connection.timeout.ms=18000
group.initial.rebalance.delay.ms=0
3.Kafka服务项
启动:/usr/local/kafka/bin/kafka-server-start.sh -daemon /usr/local/kafka/config/server.properties
标签:bin,data,zookeeper,kafka,集群,usr,local From: https://www.cnblogs.com/Oldtiger/p/16735784.html