|Connor 99e488dba7 raftstore: adjust leader metircs (#4092)||2 days ago|
|.circleci||4 months ago|
|.github||1 month ago|
|benches||6 days ago|
|ci-build||6 months ago|
|components||5 days ago|
|docker||4 months ago|
|docs||3 days ago|
|etc||2 days ago|
|fuzz||1 week ago|
|images||2 months ago|
|src||2 days ago|
|tests||6 days ago|
|.dockerignore||3 months ago|
|.gitignore||1 month ago|
|CHANGELOG.md||5 days ago|
|CONTRIBUTING.md||5 months ago|
|Cargo.lock||5 days ago|
|Cargo.toml||5 days ago|
|Dockerfile||3 months ago|
|Jenkinsfile||1 year ago|
|LICENSE||2 years ago|
|MAINTAINERS.md||6 months ago|
|Makefile||1 week ago|
|README.md||6 days ago|
|rust-toolchain||6 months ago|
|rustfmt.toml||1 year ago|
TiKV ("Ti" stands for Titanium) is an open source distributed transactional key-value database. Unlike other traditional NoSQL systems, TiKV not only provides classical Key-Value APIs, but also transactional APIs with ACID compliance. Built in Rust and powered by Raft, TiKV was originally created to complement TiDB, a distributed HTAP database compatible with the MySQL protocol.
The design of TiKV is inspired by some great distributed systems from Google, such as BigTable, Spanner, and Percolator, and some of the latest achievements in the academia in recent years, such as the Raft consensus algorithm.
TiKV is hosted by the Cloud Native Computing Foundation (CNCF). If you are an organization that wants to help shape the evolution of technologies that are container-packaged, dynamically-scheduled and microservices-oriented, consider joining the CNCF. For details about who's involved and how TiKV plays a role, read the CNCF announcement.
With the implementation of the Raft consensus algorithm in Rust and consensus state stored in RocksDB, TiKV guarantees data consistency. Placement Driver (PD), which is introduced to implement auto-sharding, enables automatic data migration. The transaction model is similar to Google's Percolator with some performance improvements. TiKV also provides snapshot isolation (SI), snapshot isolation with lock (SQL:
SELECT ... FOR UPDATE), and externally consistent reads and writes in distributed transactions.
TiKV is hosted by the Cloud Native Computing Foundation (CNCF). If you are a company that wants to help shape the evolution of cloud native technologies, consider joining the CNCF. For details about who's involved and how TiKV plays a role, read the CNCF announcement.
TiKV has the following key features:
TiKV uses Raft and the Placement Driver to support Geo-Replication.
With PD and carefully designed Raft groups, TiKV excels in horizontal scalability and can easily scale to 100+ TBs of data.
Consistent distributed transactions
Similar to Google's Spanner, TiKV supports externally-consistent distributed transactions.
Similar to Hbase, TiKV implements a coprocessor framework to support distributed computing.
Cooperates with TiDB
Thanks to the internal optimization, TiKV and TiDB can work together to be a compelling database solution with high horizontal scalability, externally-consistent transactions, support for RDBMS, and NoSQL design patterns.
You can view the list of TiKV Adopters.
You can see the TiKV Roadmap.
When a node starts, the metadata of the Node, Store and Region are recorded into PD. The status of each Region and Store is reported to PD regularly.
TiKV was originally a component of TiDB. To run TiKV you must build and run it with PD, which is used to manage a TiKV cluster. You can use TiKV together with TiDB or separately on its own.
We provide multiple deployment methods, but it is recommended to use our Ansible deployment for production environment. The TiKV documentation is available on TiKV's wiki page.
Try TiKV separately
tidb-docker-composeon a single machine
For the production environment, use Ansible to deploy the cluster.
If you want to try the Go client, see Try Two Types of APIs.
The TiKV codebase is primarily written in Rust, but has components written in C++ (RocksDB) and Go (gRPC). To provide consistency and avoid opinion-based arguments, we make extensive use of linters and automated formatting tools. Additionally, due to Rust's youth we are currently utilizing nightly builds which provide access to many useful features.
To build TiKV you'll need to at least have the following installed:
git- Version control
rustup- Rust toolchain manager
awk- Pattern scanning/processing language
cmake- Build tool (required for gRPC)
go- Programming language (required for gRPC)
make- Build tool (run common workflows)
gcc- C compiler toolchain
git clone https://github.com/tikv/tikv.git cd tikv # Future instructions assume you are in this repository
rustup is an official toolchain manager for Rust, similar to
rbenv from the Ruby world.
TiKV uses the version of the Rust toolchain specified in
cargo will automatically utilize this file. We also make use of the
rustup component add rustfmt-preview
While TiKV includes a
Makefile with common workflows, you are also able to use
cargo as you would in a normal Rust project.
At this point, you can build TiKV:
During interactive development, you may prefer using
cargo check, which will do parse, borrow check, and lint run on your code, but not actually compile it. It is particularly handy alongside
cargo-watch which will run a command each time you change a file.
cargo install cargo-watch cargo watch -s "cargo check"
When you're ready to test out your changes, use the
dev task. It will format your codebase, build with
clippy enabled, and run tests. This should run without failure before you create a PR.
You can run the full test suite locally, or just run a specific test:
# Run the full suite make test # Run a specific test cargo test $TESTNAME
Our CI systems automatically test all the pull requests, so making sure the full suite passes the test before creating your PR is not strictly required. All merged PRs must have passed CI test.
Read our configuration guide to learn about various configuration options.
Contributions are welcome! See CONTRIBUTING for details on submitting patches and the contribution workflow.
For beginners, we have prepared many suitable tasks for you. Checkout our Help Wanted issues for a list, in which we have also marked the difficulty level.
If you are planning something big, for example, relates to multiple components or changes current behaviors, make sure to open an issue to discuss with us before going on.
The TiKV team actively develops and maintains a bunch of dependencies used in TiKV, which you may be also interested in:
TiKV is under the Apache 2.0 license. See the LICENSE file for details.