TiKV Cluster
TiKV is the distributed data store cluster used in TiDB clusters. TiKV is considered a shared-nothing database that uses the Raft protocol to ensure data consistency.
Note:
TiKV nodes manage the data
PD (Placement Driver) manages the TiKV nodes
The Raft https://raft.github.io/ consensus algorithm ensures data consistency
![digraph TiKV_Cluster {
// Define the subgraph inside the main graph
node [style=filled fontname="Ariel"]
splines=curved;
bgcolor=grey;
subgraph cluster_node1 {
label="Node 1"
style=filled
color=lightgrey
a1 [shape=rectangle pos="0, 0.0!" color=lightblue label="TiKV Node"];
b1 [shape=rectangle pos="0,-1.0!" color=lightgreen label="Transaction"];
c1 [shape=rectangle pos="0,-1.5!" color=pink label="Raft"];
d1 [shape=rectangle pos="0,-2.0!" color=orange label="RocksDB"];
}
subgraph cluster_node2 {
label="Node 2"
style=filled
color=lightgrey
a2 [shape=rectangle pos="2.0, 0.0!" color=lightblue label="TiKV Node"];
b2 [shape=rectangle pos="2.0,-1.0!" color=lightgreen label="Transaction"];
c2 [shape=rectangle pos="2.0,-1.5!" color=pink label="Raft"];
d2 [shape=rectangle pos="2.0,-2.0!" color=orange label="RocksDB"];
}
subgraph cluster_node3 {
label="Node 3"
style=filled
color=lightgrey
a3 [shape=rectangle pos="4.0, 0.0!" color=lightblue label="TiKV Node"];
b3 [shape=rectangle pos="4.0,-1.0!" color=lightgreen label="Transaction"];
c3 [shape=rectangle pos="4.0,-1.5!" color=pink label="Raft"];
d3 [shape=rectangle pos="4.0,-2.0!" color=orange label="RocksDB"];
}
c1 -> c2 -> c3 [dir=both];
subgraph cluster_pd {
label="PD Cluster"
style=filled
color=lightgrey
margin=33
p1 [shape=rectangle pos="0, -3.0!" color=violet label="PD Node"];
p2 [shape=rectangle pos="2, -3.0!" color=violet label="PD Node"];
p3 [shape=rectangle pos="4, -3.0!" color=violet label="PD Node"];
}
p2 -> d2 [dir = both ltail=cluster_pd lhead=cluster_node2];
label_below_node1 [shape=plaintext pos="2,-3.5!" label="PD Cluster" pin=true]
}](../../../../_images/graphviz-d9dcee5b416c12fcaef6be9ea496eb00f417be98.png)
See https://tikv.org/docs/ and https://docs.pingcap.com/tidb/stable/tidb-architecture/ for more detail.