【Kafka八】Zookeeper上关于Kafka的配置信息
问题:1. Kafka的哪些信息记录在Zookeeper中
2. Consumer Group消费的每个Partition的Offset信息存放在什么位置 3. Topic的每个Partition存放在哪个Broker上的信息存放在哪里
4. Producer跟Zookeeper究竟有没有关系?没有关系!!!
//consumers、config、brokers、controller_epoch都是Kafka相关的znode
ls /
ls
///consumers目录下是所有的consumer group的定义
ls /consumers
ls learn.topic.p8.r2.consumers.group
Command failed: java.lang.IllegalArgumentException: Path must start with / character
///consumer group下游offsets、owners和ids的定义
ls /consumers/learn.topic.p8.r2.consumers.group
///offsets下面是topic的定义
ls /consumers/learn.topic.p8.r2.consumers.group/offsets
///topic下面是partition的定义,learn.topic.p8.r2表示8个partition,2个副本
///partition中的offset的设置在znode的data中,而不是子znode中
ls /consumers/learn.topic.p8.r2.consumers.group/offsets/learn.topic.p8.r2
ls /consumers/learn.topic.p8.r2.consumers.group/offsets/learn.topic.p8.r2/2
[]
ls /consumers/learn.topic.p8.r2.consumers.group/offsets/learn.topic.p8.r2/3
[]
ls /consumers/learn.topic.p8.r2.consumers.group/offsets/learn.topic.p8.r2/4
[]
///consumer group属于哪个topic所有,代码中不需要显式指定
///consumer group消费哪个topic,kafka自动将topic设置为这个consumer group的owner
ls /consumers/learn.topic.p8.r2.consumers.group/owners
ls /consumers/learn.topic.p8.r2.consumers.group/owners/learn.topic.p8.r2
ls /consumers/learn.topic.p8.r2.consumers.group/owners/learn.topic.p8.r2/3
[]
///后面是broker的ID
ls /consumers/learn.topic.p8.r2.consumers.group/ids
ls /consumers/learn.topic.p8.r2.consumers.group/ids/learn.topic.p8.r2.consumers.group_TP-A383-D-1427853446455-efa1e47b
[]
ls /brokers
ls /brokers/topics
ls /brokers/topics/learn.topic.p8.r2
ls /brokers/topics/learn.topic.p8.r2/partitions
ls /brokers/topics/learn.topic.p8.r2/partitions/3
ls /brokers/topics/learn.topic.p8.r2/partitions/3/state
[]
ls /brokers/ids
ls /brokers/ids/2
[]
每个Consumer Group的每个Partition的Offset信息是作为值存放在Partition节点上的,而不是作为子节点,如下所示,4704是3号Partition已经消费的Offset数
get /consumers/learn.topic.p8.r2.consumers.group/offsets/learn.topic.p8.r2/3
4704
cZxid = 0x1bf14
ctime = Tue Mar 31 06:25:39 EDT 2015
mZxid = 0x1c658
mtime = Tue Mar 31 22:03:48 EDT 2015
pZxid = 0x1bf14
cversion = 0
dataVersion = 177
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 4
numChildren = 0
Topic的每个Partition存放在哪个Broker上的信息存放在哪里?
ls /brokers
ls /brokers/topics
ls /brokers/topics/learn.topic.p8.r2
ls /brokers/topics/learn.topic.p8.r2/partitions
ls /brokers/topics/learn.topic.p8.r2/partitions/3
ls /brokers/topics/learn.topic.p8.r2/partitions/3/state
[]
///
get/brokers/topics/learn.topic.p8.r2/partitions/3/state
{"controller_epoch":42,"leader":0,"version":1,"leader_epoch":2,"isr":}
cZxid = 0x1bee8
ctime = Tue Mar 31 05:34:16 EDT 2015
mZxid = 0x1c247
mtime = Tue Mar 31 21:48:01 EDT 2015
pZxid = 0x1bee8
cversion = 0
dataVersion = 5
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 75
numChildren = 0
每个Broker的信息:包括host和port
//三个broker
ls/brokers/ids
ls/brokers/ids/2
[]
///host和port信息
get/brokers/ids/2
{"jmx_port":-1,"timestamp":"1427852973061","host":"192.168.26.140","version":1,"port":9094}
cZxid = 0x1c257
ctime = Tue Mar 31 21:49:33 EDT 2015
mZxid = 0x1c257
mtime = Tue Mar 31 21:49:33 EDT 2015
pZxid = 0x1c257
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x14c72a6b3610003
dataLength = 91
numChildren = 0
每个Topic的Partion存放在哪个或者哪些Broker上,信息存放在
///每个partition的leaderpartition和follower partition信息
get /brokers/topics/learn.topic.p8.r2
{"version":1,"partitions":{"4":,"5":,"6":,"1":,"0":,"2":,"7":,"3":}}
页:
[1]