乱读天书, 不求甚解
周祎骏的个人云笔记
Toggle navigation
乱读天书, 不求甚解
主页
Linux:系统配置
Linux:用户管理
Linux:优化排错
Linux:进程调度
Linux:文件系统
Linux:网络
Linux:系统服务
Linux:安全
Linux:内核
容器:Docker
容器:containerd
容器编排:Kubernetes
IAC:Terraform
大数据:Hadoop
大数据:Zookeeper
大数据:Hbase
消息队列:rsyslog
消息队列:kafka
数据库:MySQL
数据库:MongoDB
搜索引擎:Elasticsearch
时序数据库:OpenTSDB
网站服务:Nginx
编程:Bash
编程:Perl
编程:Python
编程:C
编程:JAVA
编程:Rust
版本控制:gitlab
知识管理:docusaurus
常用小工具
关于我
标签
kafka 2.0 使用入门
2017-04-09 10:38:33
99
0
0
admin
> 这里介绍kafka的的使用方式 #详细配置 http://kafka.apache.org/documentation/#configuration *** #开启关闭 ./bin/kafka-server-start.sh -daemon ./config/server.properties ./bin/kafka-server-stop.sh #比起kill -9, 这种关闭方式会比较安全。 *这个脚本其实就是ps找到pid,然后kill -s TERM $PIDS,脚本写的不好,有时候抓不到进程号。* *** #创建/修改/删除topic **创建topic** bin/kafka-topics.sh --zookeeper zk_host:port --create --topic topic名 --partitions 分片数 --replication-factor 备份数 --config x=y **列出所有topic** ./bin/kafka-topics.sh --zookeeper localhost:2181 --list **查看topic** ./bin/kafka-topics.sh --zookeeper localhost:2181 --describe ./bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic xxx 该命令会显示一个topic 的各个配置,replic 数量和对应的broker_id以及isr 所对应的broker_id **修改topic** bin/kafka-topics.sh --zookeeper zk_host:port --alter --topic topic名 --partitions 分片数 --config x=y bin/kafka-topics.sh --zookeeper zk_host:port --alter --topic topic名 --partitions 分片数 --delete-config x **删除topic** bin/kafka-topics.sh --zookeeper zk_host:port --delete --topic topic名 需要配置文件中配置delete.topic.enable=true *** ##topic配置 ``` retention.ms 数据保留多少毫秒 segment.index.bytes 数据保留多少字节 ``` *** #读写数据 写: bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test 读: bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
上一篇:
kafka 1.0 安装
下一篇:
kafka 3.0 水平扩展/迁移数据
文档导航