1 Star 0 Fork 0

Zychaowill / Spring-Kafka

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

Spring-Kafka

Spring integrate with Kafka. This project based on Spring Boot 2.0.

  • run zookeeper
./bin/zkServer.sh
  • run kafka server
./bin/kafka-server-start.sh ./config/server.properties
  • create kafka topic
./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partition 1 --topic test
  • run kafka console producer
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
  • run kafka console consumer
./bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test

Kafka常用命令

  • 列出主题
./bin/kafka-topic.sh -list --zookeeper localhost:2181
  • 描述主题
./bin/kafka-topic.sh -describe --zookeeper localhost:2181 -topic [topic name]
  • 从头读取消息
./bin/kafka-console-consumer.sh --zookeeper localhost:2181 -topic [topic name] -from-beginning
  • 删除主题
./bin/kafka-run-class.sh kafka.admin.TopicCommand -delete -topic [topic_to_delete] -zookeeper localhost:2181
  • 查看topic的详细信息
./bin/kafka-topic.sh --zookeeper localhost:2181 -describe -topic [topic name]
  • 为topic增加副本
./bin/kafka-reassign-partitions.sh --zookeeper localhost:2181 --reassignment-json-file json/partitions-to-move.json -execute
  • 为topic添加partition
./bin/kafka-topic.sh --zookeeper localhost:2181 -alter -partitions 20 -topic [topic name]
  • 下线broker
./bin/kafka-run-class.sh kafka.admin.ShutdownBroker --zookeeper localhost:2181 broker [brokerId] --num.retries 3 -retry.interval.ms 60 shudown broker

Comments ( 0 )

Sign in for post a comment

About

No description spread retract
Java
Apache-2.0
Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
Java
1
https://gitee.com/Zychaowill/Spring-Kafka.git
git@gitee.com:Zychaowill/Spring-Kafka.git
Zychaowill
Spring-Kafka
Spring-Kafka
master

Search