linux部署单机kafka(使用kafka自带zookeeper)
部署说明
本文使用kafka单节点安装及配置,并使用kafka自带的zookeeper。一般kafka需要起三个kafka构成集群,可以连单独的zookeeper,本文不涉及。
kafka下载
- 根据需要下载对应版本的安装包,下载地址: https://archive.apache.org/dist/kafka/
- 上传安装包并解压重命名(路径自定义): 如:上传到 /opt 路径下 解压和重命名:
cd opt tar -zxvf kafka_2.12-2.5.0.tgz mv kafka_2.12-2.5.0 kafka
修改zookeeper配置
vim kafka/config/zookeeper.properties
dataDir=/opt/kafka # the port at which the clients will connect clientPort=2181 # disable the per-ip limit on the number of connections since this is a non-production config maxClientCnxns=100 # Disable the adminserver by default to avoid port conflicts. # Set the port to something non-conflicting if choosing to enable this admin.enableServer=false # admin.serverPort=8080
修改kafka配置
vim kafka/config/server.properties
broker.id=0 listeners=PLAINTEXT://192.168.111.111:9092 advertised.listeners=PLAINTEXT://192.168.111.111:9092 log.dirs=/opt/kafka/kafka-logs zookeeper.connect=192.168.111.111:2181 # 本机ip host.name=192.168.111.111
启动zookeeper
./zookeeper-server-start.sh ../config/zookeeper.properties &
启动kafka
./kafka-server-start.sh ../config/server.properties &
下一篇:
Python比较日期的实用方法