跳至主要內容

Kafka 环境

小于 1 分钟

Kafka 环境

1 Downloads

kafka_2.13-3.1.0.tgz: https://kafka.apache.org/downloadsopen in new window

1.1 文件校验

https://downloads.apache.org/kafka/3.1.0/kafka_2.13-3.1.0.tgz.sha512open in new window

$ Get-FileHash kafka_2.13-3.1.0.tgz -Algorithm SHA512 | Format-List

Algorithm : SHA512
Hash      : 5954C1CF38187134A6E0A21520CBEF5CD5320A3E9290E630C3895990E892219917D911FABBC64DA5DB17BCAA940B8277C23344B50F2FF4256EACA78116E9FDC9
Path      : D:\下载2\linux-downloads\kafka_2.13-3.1.0.tgz

2 单机模式

kafka 环境依赖 zookeeper 环境,详见 zookeeper 环境

# 解压
tar zxvf kafka_2.13-3.1.0.tgz
cd kafka_2.13-3.1.0

# 启动
./bin/kafka-server-start.sh -daemon config/server.properties

# 停止
./bin/kafka-server-stop.sh

# 查看进程
$ jps -l
63425 kafka.Kafka
63892 sun.tools.jps.Jps
60308 org.apache.zookeeper.server.quorum.QuorumPeerMain

3 集群模式

./config/server.properties

############################# Server Basics #############################

# The id of the broker. This must be set to a unique integer for each broker.
broker.id=0

############################# Socket Server Settings #############################

# The address the socket server listens on. It will get the value returned from
# java.net.InetAddress.getCanonicalHostName() if not configured.
#   FORMAT:
#     listeners = listener_name://host_name:port
#   EXAMPLE:
#     listeners = PLAINTEXT://your.host.name:9092
#listeners=PLAINTEXT://:9092
listeners=PLAINTEXT://localhost.ubuntu0.com:9092

############################# Zookeeper #############################

# Zookeeper connection string (see zookeeper docs for details).
# This is a comma separated host:port pairs, each corresponding to a zk
# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".
# You can also append an optional chroot string to the urls to specify the
# root directory for all kafka znodes.
# zookeeper.connect=localhost:2181
zookeeper.connect=localhost.ubuntu0.com:2181,localhost.ubuntu1.com:2181,localhost.ubuntu2.com:2181



 









 
 








 
 
# 启动
./bin/kafka-server-start.sh -daemon config/server.properties

运行截图:

(全文完)