Kafka集群
2023-04-08 16:01:43 7 举报
登录查看完整内容
详细介绍
作者其他创作
大纲/内容
partition1follower
consumer
consumer group
producer01
分区1-》ProducerBatch
msg
segment_1
topicApartition2+replication3
consumer3
存放具体消息的文件
partition分区器
producer
segment
partition2leader
将分区1-》ProducerBatch封装成node1-》request发送给selector并缓存到inflightRequest
sender线程
topicA
log每增加4k生成一个index每个索引里面记录了log中的offset和positionspan style=\
partition1leader
consumer1
broker
partition2follower
消息累加器RecordAccumulator
consumer3+consumer4没有消费到数据因为一个分区只能给一个消费者组里的一个消费者消费到所以要提升消费能力需要只增加消费者是不够的同时需要增加分区数
brokercontroller
每1G或者7天生成一个新的segment
ProducerInterceptor拦截器
segment_3
kafka cluster
命名规则:第二个segment的第一条消息的offset组成
分区2-》ProducerBatch
consumer4
1、主线程调用send()方法将已经和topic和分区绑定好的消息,以分区为单位维护一个双端队列,将消息缓存起来(缓存的对象是ProducerRecord对象)。2、KafkaProducer将发送的数据封装成一个 ProducerRecord 对象。对象包含:topic:string 类型,NotNull。partition:int 类型,可选。timestamp:long 类型,可选。key:string 类型,可选。value:string 类型,可选。headers:array 类型,Nullable。3、当达到一定的条件,会唤醒Sender线程发送RecordAccumulator里面的消息。buffer.memory:设置生产者内存缓冲区的大小,默认为 32M。span style=\
RecordAccumulator
timeindex
TopicA-1
node1-》request
inflightRequest
segment_2
segmentAll
producer02
consumer2
记录log文件的偏移量,和产生时间
log
KafkaProducer
Serializer序列化器
sender
index
zookeeper
node2-》request
Kafka cluster
selector
创建requset
0 条评论
回复 删除
下一页