外贸网站建设公司方案,wordpress百度云伪静态,网站支持asp,delphi10.2 网站开发一、Kafka下载
下载地址#xff1a;https://kafka.apache.org/downloads
二、Kafka安装 因为选择下载的是 .zip 文件#xff0c;直接跳过安装#xff0c;一步到位。 选择在任一磁盘创建空文件夹#xff08;不要使用中文路径#xff09;#xff0c;解压之后把文件夹内容…一、Kafka下载
下载地址https://kafka.apache.org/downloads
二、Kafka安装 因为选择下载的是 .zip 文件直接跳过安装一步到位。 选择在任一磁盘创建空文件夹不要使用中文路径解压之后把文件夹内容剪切进去本人选择 D:\env-java\路径下即完成安装。 linux解压命令tar -zxvf kafka_2.13-3.5.1.tgzlinux环境下指令是在\kafka_2.13-3.5.1\bin目录。 windows直接解压即可windows环境下指令是在kafka_2.13-3.5.1\bin\windows目录。 注意不同系统指令所在的目录不同。 执行命令当前目录D:\env-java\kafka_2.13-3.5.1 修改 kafka-server 和zookeeper配置
进入到目录kafka_2.13-3.5.1/config/server.properties以及kafka_2.13-3.5.1/config/zookeeper.properties
linux系统:
broker.id1
log.dir/Users/imagetask/kafka-logswindows系统:
broker.id1
log.dirs/env-java/kafka_2.13-3.5.1/kafka-logs/表示当前的根路径即D盘。没有就会创建对应的文件夹。
三、启动Kafka服务
1、启动ZooKeeper
linux系统:
bin/zookeeper-server-start.sh -daemon config/zookeeper.propertieswindows系统:
bin\windows\zookeeper-server-start.bat config\zookeeper.properties 2、启动kafka
linux系统:
bin/kafka-server-start.sh config/server.propertieswindows系统:
bin\windows\kafka-server-start.bat config\server.properties四、Kafka的使用
1、创建主题
linux系统:
bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic testwindows系统:
bin\windows\kafka-topics.bat --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test2、查看Topic 列表
linux系统:
bin/kafka-topics.sh --list --bootstrap-server localhost:9092windows系统:
bin\windows\kafka-topics.bat --list --bootstrap-server localhost:90923、启动 Producer
linux系统:
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testwindows系统:
bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic test4、启动 Consumer
linux系统:
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginningwindows系统:
bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning5、查看Topic 相关信息test
linux系统:
bin/kafka-topics.sh --describe --bootstrap-server localhost:9092 --topic testwindows系统:
bin\windows\kafka-topics.bat --describe --bootstrap-server localhost:9092 --topic test详细了解可参考以下视频 实用开发篇-130-Kafka安装