9.kafka单实例安装

1.环境信息

OS Version Zookeeper Version User
RHEL7.7 3.8.0 root

kafka官网下载地址:Apache Kafka

备注:与<4.zookeeper单实例安装>在同一台服务器。也需要jdk支持

2.kafka单实例安装

1.上传kafka_2.13-3.3.2.tgz

E.g:上传至/opt目录

2.解压

命令:

tar -zxvf kafka_2.13-3.3.2.tgz

3.配置server.properties

命令:

cd /opt/kafka_2.13-3.3.2/config

vim server.properties

#kafka日志目录
log.dirs=/tmp/kafka-logs
更改至(按需更改):
log.dirs=/opt/kafka

#zookeeper配置节点
#由于kafka与zookeeper在同一台服务器,保持localhost值不会
zookeeper.connect=localhost:2181

#其它参数保持默认

完整的server.properties

命令:

grep -aiwvE "^#|^$" server.properties

broker.id=0
listeners=PLAINTEXT://:9092
#advertised.listeners=PLAINTEXT://your.host.name:9092
#listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL
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=/opt/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.flush.interval.messages=10000
#log.flush.interval.ms=1000
log.retention.hours=168
#log.retention.bytes=1073741824
#log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
zookeeper.connect=localhost:2181
zookeeper.connection.timeout.ms=18000
group.initial.rebalance.delay.ms=0

4.启动kakfa

前提:zookeeper要启动起来

命令:

./kafka-server-start.sh -daemon /opt/kafka_2.13-3.3.2/config/server.properties

[root@rhel77 bin]# pwd
/opt/kafka_2.13-3.3.2/bin
[root@rhel77 bin]# 
[root@rhel77 bin]# ./kafka-server-start.sh -daemon /opt/kafka_2.13-3.3.2/config/server.properties 
[root@rhel77 bin]# 

5.查看kafka进程和端口

命令:

ps -ef |grep -ai kafka

netstat -antulp | grep -aiwE 9092

[root@rhel77 bin]# ps -ef |grep -ai kafka
root       4279      1  5 21:40 pts/0    00:00:

你可能感兴趣的:(Kafka,kafka,分布式)