Kafka 简易使用指南
安装
mkdir /app/kafka
cd /app/kafka
wgethttps://mirrors.bfsu.edu.cn/apache/kafka/2.8.0/kafka_2.13-2.8.0.tgz
tar -xzf kafka_2.13-2.8.0.tgz
cd kafka_2.13-2.8.0## 安装 JDK
yum install java-1.8.0-openjdk.x86_64 -y# 启动 zookeeper
bin/zookeeper-server-start.sh config/zookeeper.properties# 启动 kafka broker
bin/kafka-server-start.sh config/server.properties
消息操作
# 创建 Topic
bin/kafka-topics.sh --create --topic quickstart-events --bootstrap-server localhost:9092# 生产消息
bin/kafka-console-producer.sh --topic quickstart-events --bootstrap-server localhost:9092# 消费消息
bin/kafka-console-consumer.sh --topic quickstart-events --from-beginning --bootstrap-server localhost:9092
配置 supervisor 启动
kafka-zookeeper.conf
[program:kafka-zookeeper]
command = /app/kafka/kafka_2.13-2.8.0/bin/zookeeper-server-start.sh /app/kafka/kafka_2.13-2.8.0/config/zookeeper.properties
autostart = true
startsecs = 5
autorestart = true
startretries = 3
user = root
redirect_stderr = true
stdout_logfile_maxbytes = 20MB
stdout_logfile_backups = 20
stdout_logfile = /app/kafka/log/zookepper.log
kafka-server.conf
[program:kafka-server]
command = /app/kafka/kafka_2.13-2.8.0/bin/kafka-server-start.sh /app/kafka/kafka_2.13-2.8.0/config/server.properties
autostart = true
startsecs = 5
autorestart = true
startretries = 3
user = root
redirect_stderr = true
stdout_logfile_maxbytes = 20MB
stdout_logfile_backups = 20
stdout_logfile = /app/kafka/log/server.log
推荐阅读
- 深入浅出谈一下有关分布式消息技术(Kafka)
- 15.Kafka
- iPhone手机这些使用指南|iPhone手机这些使用指南 你知道多少()
- 简易有效Api接口防攻击策略
- 家庭简易版金沙奶黄包
- PHP简易规则引擎
- Springboot整合kafka的示例代码
- 小程序简易轮播图
- nginx简易安装和配置
- 这是一个分类的世界