Linux离线安装单体Kafka
一. 下载离线安装包
到官网下载离线安装包:
zookeeper:https://zookeeper.apache.org/releases.html
kafka:http://kafka.apache.org/downloads
二. zookeeper 安装
1.解压相应文件
tar -zxvf apache-zookeeper-3.5.8-bin.tar.gz
2.修改zookeeper相关配置文件
mkdir /usr/local/zookeeper
mv apache-zookeeper-3.5.8-bin/ /usr/local/zookeeper/zookeeper3.5
cd /usr/local/zookeeper/zookeeper3.5
cp conf/zoo_sample.cfg conf/zoo.cfg
vim conf/zoo.cfg
修改zoo.cfg 中配置:
dataDir=/usr/local/zookeeper/zookeeper3.5/data //数据存储位置
dataLogDir=/usr/local/zookeeper/zookeeper3.5/logs //日志存储位置
3.启动zookeeper
./bin/zkServer.sh start
三. kafka安装
1.解压相应的文件
tar -zxvf kafka_2.12-2.5.0.tgz
2.修改kafka配置文件config/server.properties
mkdir /usr/local/kafka
mv kafka_2.12-2.5.0/ /usr/local/kafka/kafka2.12
cd /usr/local/kafka/kafka2.12
vim config/server.properties
如果只是本地访问只需要修改配置:
listeners=PLAINTEXT://:9092
log.dirs=/usr/local/kafka/kafka2.12/logs
如果需要远程访问,则再此基础上再添加配置:
advertised.listeners=PLAINTEXT://192.168.99.101:9092
这里192.168.99.101是你远程服务器的ip
3. 启动kafka
nohup ./bin/kafka-server-start.sh config/server.properties &