kafka消费者和消费者组

2022-01-17  本文已影响0人  wayyyy

上文的环境,我们已经搭建了拥有3个节点的kafka集群,并创建了topic(分区数为4,副本因子为3(3个broker))

# docker ps
  CONTAINER ID        IMAGE                COMMAND                  CREATED             STATUS              PORTS                                                  NAMES
  4056558ea9ab        wurstmeister/kafka   "start-kafka.sh"         2 hours ago         Up 2 hours          0.0.0.0:19094->9092/tcp                                kafka3
  fc3e6eb2fdea        wurstmeister/kafka   "start-kafka.sh"         2 hours ago         Up 2 hours          0.0.0.0:19093->9092/tcp                                kafka2
  dd1536016f31        wurstmeister/kafka   "start-kafka.sh"         2 hours ago         Up 2 hours          0.0.0.0:19092->9092/tcp                                kafka1
  5e9c4f4911a0        zookeeper            "/docker-entrypoin..."   2 hours ago         Up 2 hours          2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp, 8080/tcp   zookeeper

# ./kafka-topics.sh --zookeeper 192.168.48.134:2181 --describe --topic test
  Topic: test TopicId: _A5YjE72QWeECBPEOFCquw PartitionCount: 4   ReplicationFactor: 3    Configs: 
    Topic: test   Partition: 0    Leader: 3   Replicas: 3,2,1 Isr: 3,2,1
    Topic: test   Partition: 1    Leader: 1   Replicas: 1,3,2 Isr: 1,3,2
    Topic: test   Partition: 2    Leader: 2   Replicas: 2,1,3 Isr: 2,1,3
    Topic: test   Partition: 3    Leader: 3   Replicas: 3,1,2 Isr: 3,1,2
消费者

这里我们使用go语言,kafka 客户端使用 github.com/Shopify/sarama v1.29.1 版本

消费者组
上一篇下一篇

猜你喜欢

热点阅读