部署说明
本文使用kafka单节点安装及配置,并使用kafka自带的zookeeper。一般kafka需要起三个kafka构成集群,可以连单独的zookeeper,本文不涉及。文章来源地址https://www.toymoban.com/news/detail-565852.html
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 &
文章来源:https://www.toymoban.com/news/detail-565852.html
到了这里,关于linux部署单机kafka(使用kafka自带zookeeper)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!