pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.42k stars 5.85k forks source link

any crash recovery stuff? difficult to find online though i hvnt try crashing it yet. just wondering how to recover. #37676

Closed vipsland closed 1 month ago

vipsland commented 2 years ago

any crash recovery stuff? difficult to find online though i hvnt try crashing it yet. just wondering how to recover if anything goes wrong.

also if i can understand the internal mechanics of how sharding works i can better prepare on backup strategies in case the failed node can be better remedied and isolated.

ljluestc commented 1 year ago

Data recovery in TiDB is mainly handled by the underlying storage engines. TiDB supports multiple storage backends, such as TiKV and TiFlash. These storage engines have their own mechanisms for data replication and crash recovery.

For example, TiKV uses the Raft consensus algorithm to replicate data across multiple nodes, ensuring that data is available even if some nodes fail. When a node crashes and comes back online, it can catch up with the latest data through the Raft replication process.