1
Kafka Needs No Keeper
Colin McCabe
Kafka Needs No Keeper Colin McCabe 2 Introduction Kafka has - - PowerPoint PPT Presentation
1 Kafka Needs No Keeper Colin McCabe 2 Introduction Kafka has gotten its mileage out of Zookeeper But it is still a second system KIP-500 has been adopted by the community This is not a 1-1 replacement Weve been
1
Colin McCabe
2
3
4
Producer Consumer Admin Tools
5
write to topics Producer Consumer Admin Tools
6
write to topics read from topics Producer Consumer Admin Tools
7
write to topics read from topics
fetch/commit group partition assignment Producer Consumer Admin Tools
8
write to topics read from topics
fetch/commit group partition assignment topic create/delete Producer Consumer Admin Tools
9
10
Consumer
fetch/commit group partition assignment read from topics
11
Consumer
fetch/commit group partition assignment read from topics Consumer APIs
12
Consumer
fetch/commit group partition assignment read from topics Consumer APIs
13
Consumer Consumer APIs
fetch/commit group partition assignment read from topics
__offsets
14
fetch/commit Consumer group partition assignment read from topics Consumer APIs
__offsets
15
Consumer group partition assignment read from topics
fetch/commit Consumer APIs
__offsets
16
Consumer group partition assignment read from topics
fetch/commit Consumer APIs
__offsets
17
group partition assignment Consumer read from topics
fetch/commit Consumer APIs
__offsets
18
Consumer read from topics
fetch/commit group partition assignment Consumer APIs
__offsets
19
Consumer read from topics
fetch/commit group partition assignment Consumer APIs
__offsets
20
read from topics
fetch/commit group partition assignment Consumer Consumer APIs
__offsets
21
Consumer Producer Admin Tools create/delete topics
22
23
Consumer Producer create/delete topics Admin Tools
24
ACL Enforcement create/delete topics Admin Tools Consumer Producer
25
create/delete topics ACL Enforcement Admin Tools Consumer Producer
26
create/delete topics ACL Enforcement Admin Tools
27
AdminClient Admin Tools ACL Enforcement create/delete topics
28
AdminClient Admin Tools ACL Enforcement create/delete topics Admin APIs:
29
Admin APIs:
AdminClient Admin Tools ACL Enforcement
30
Producer Consumer AdminClient Client APIs:
31
Producer Consumer AdminClient Client APIs:
32
33
34
Broker Registration ACL Management Dynamic Configuration ISR Management
35
Controller Broker Registration ACL Management Dynamic Configuration ISR Management
36
Controller Broker Registration ACL Management Dynamic Configuration ISR Management Controller Election
37
Controller Broker Registration ACL Management Dynamic Configuration ISR Management Controller Election
38
Controller Broker Registration ACL Management Dynamic Configuration ISR Management Controller Election
39
Controller Controller APIs:
Leader/ISR Push Update Metadata Stop/Delete Replica Broker Registration ACL Management Dynamic Configuration ISR Management Controller Election
40
Controller Controller APIs:
Leader/ISR Push Update Metadata Stop/Delete Replica Broker Registration ACL Management Dynamic Configuration ISR Management Controller Election
41
Controller Controller APIs:
Leader/ISR Push Update Metadata Stop/Delete Replica Broker Registration ACL Management Dynamic Configuration ISR Management Controller Election
42
Controller Controller APIs:
Broker Registration ACL Management Dynamic Configuration ISR Management Controller Election Leader/ISR Push Update Metadata Stop/Delete Replica
43
Controller Leader/ISR Push Update Metadata Stop/Delete Replica ISR Management Controller APIs:
Broker Registration ACL Management Dynamic Configuration ISR Management Controller Election
44
45
46
47
Zk Session
48 /brokers/1 -> { host: 10.10.10.1:9092 rack: rack-1 }
49 /brokers/1 -> { host: 10.10.10.1:9092 rack: rack-1 }
50
51
Watch trigger
52
Watch trigger Broker 1 is offline
53
54
55
Case 1: Total partition
56
Case 2: Broker partition
57
Case 3: Zk Partition
58
Case 4: Controller partition
59
60
61
Metadata Source
62
Metadata Source
Metadata Cache
63
Metadata Source
Metadata Cache
Metadata Cache
Metadata Cache
64
65
66
67
Last Resort: > rmr /controller
68
Last Resort: > rmr /controller New controller!
69
Last Resort: > rmr /controller Load ALL Metadata
70
Last Resort: > rmr /controller Load ALL Metadata
71
Last Resort: > rmr /controller Push ALL Metadata
72
Last Resort: > rmr /controller Push ALL Metadata
73
Last Resort: > rmr /controller Push ALL Metadata How do you know the metadata has diverged?
74
75
76
77
New controller!
78
Load ALL Metadata
79
Load ALL Metadata Complexity: O(N) N = number of partitions
80
81
Push ALL Metadata
82
Push ALL Metadata Complexity: O(N*M) N = number of partitions M = number of brokers
83
84 84
... 924 Create topic ”foo” 925 Delete topic “bar” 926 Add node 4 to the cluster 927 Create topic “baz” 928 Alter ISR for “foo-0” 929 Add node 5 to the cluster
85 85
... 924 Create topic ”foo” 925 Delete topic “bar” 926 Add node 4 to the cluster 927 Create topic “baz” 928 Alter ISR for “foo-0” 929 Add node 5 to the cluster
86
Consumer Consumer Consumer
87
Broker Broker Broker
88
Broker Broker Broker Controller
89
90
91
Kafka Raft Writes Single Leader Single Leader Fencing Monotonically increasing epoch Monotonically increasing term Log reconciliation Offset and epoch Term and index Push/Pull Pull Push Commit Semantics ISR Majority Leader Election From ISR through Zookeeper Majority
92
93
Broker Broker Controller Controller Controller
94
Broker Broker Controller Controller Controller
95
/mnt/logs/kafka/metadata
Broker Broker Controller Controller Controller
/mnt/logs/kafka/metadata
96
97
98
99
100
101
102
103
104
105
106
Current KIP-500 Configuration File Kafka and ZooKeeper Kafka Metrics Kafka and ZK Kafka Administrative Tools ZK Shell, Four letter words, Kafka tools Kafka tools Security Kafka and ZK Kafka
107
108
109
110
111
access
112
direct ZK access for tools
APIs
in the controller
113
114
115
116
117
118
119
120
121
122
123
124
cnfl.io/meetups cnfl.io/blog cnfl.io/slack