一.安装jdk ,kafka需要至少jdk8+
1.安装jdk
yum install java-11-openjdk.x86_64 -y
2.查看安装是否正常
[root@localhost bin]# java --version openjdk 11.0.21 2023-10-17 LTS OpenJDK Runtime Environment (Red_Hat-11.0.21.0.9-1.el7_9) (build 11.0.21+9-LTS) OpenJDK 64-Bit Server VM (Red_Hat-11.0.21.0.9-1.el7_9) (build 11.0.21+9-LTS, mixed mode, sharing)
二.安装kafka
1.官网:http://kafka.apache.org/downloads
curl -O https://downloads.apache.org/kafka/3.5.1/kafka-3.5.1-src.tgz
2.创建目录
mkdir -p /mnt/kafka # 创建kafka家目录 mkdir -p /mnt/kafka/kafka_data # 创建kafka数据存储目录 mkdir -p /mnt/kafka/kafka_data/zookeeper # 创建zookeeper数据目录 mkdir -p /mnt/kafka/kafka_data/log/kafka # 创建kafka日志存储目录 mkdir -p /mnt/kafka/kafka_data/log/zookeeper # 创建zookeeper日志存储目录
3.压缩包解压
tar -xf kafka_2.12-3.5.1.tgz -C /mnt/kafka/
4.配置kafka服务
vi /mnt/kafka/kafka_2.12-3.5.1/config/server.properties
5.添加或修改如下内容
broker.id=0 port=9092 #端口号 host.name=192.168.186.20 #服务器IP地址,修改为自己的服务器IP log.dirs=/mnt/kafka/kafka_data/log/kafka #日志存放路径,上面创建的目录 zookeeper.connect=localhost:2181 #zookeeper地址和端口,单机配置部署,localhost:2181
[root@localhost bin]# grep -Ev '$^|#' /mnt/kafka/kafka_2.12-3.5.1/config/server.properties broker.id=0 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=/mnt/kafka/kafka_data/log/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.retention.check.interval.ms=300000 zookeeper.connect=localhost:2181 zookeeper.connection.timeout.ms=18000 group.initial.rebalance.delay.ms=0 port=9092 host.name = 192.168.186.20
标签:12,log,zookeeper,mnt,kafka,3.5,集群,data From: https://www.cnblogs.com/chenzhi2023/p/17867020.html