Distributed transactional key-value database, originally created to complement TiDB

Nick Cameron 1d28db09b2 Pass tests on Mac OS (#5627) 19 hours ago
.github eb0d98b7e5 Update pull_request_template (#5559) 2 weeks ago
benches 24ce8e093a upgrade criterion and use total instructions measurement (#5558) 4 days ago
ci-build 4a2700b87f Change Copyright holders to the TiKV Authors (#4438) 6 months ago
cmd 207764c20c Build: Prune Duplicated dependency(#5595) (#5626) 5 days ago
components f7f9a5944f Panic on rocksdb background error (#5550) 1 day ago
docs 2074af2a82 Makefile: Remove `run` target (#5374) 3 weeks ago
etc 2086b7b193 deadlock: speed up detecting leader change of the deadlock detector (#5028) 1 month ago
fuzz 24ce8e093a upgrade criterion and use total instructions measurement (#5558) 4 days ago
images fa6e6d3eda docs/reference: add raftstore topic (#4950) 3 months ago
scripts 4861c61018 scripts: upadte gen-dockerfile.sh (#5337) 1 month ago
src 1d28db09b2 Pass tests on Mac OS (#5627) 19 hours ago
tests cf550ee019 txn: Implement check_txn_status API (#5390) 3 days ago
.dockerignore 7315140a1a produce an Alpine Linux image (#3697) 11 months ago
.gitignore 9fd1cb345c .gitignore: Add generated files (#5377) 1 month ago
CHANGELOG.md dd8dbea542 Update CHANGELOG to include all versions (#5477) 2 weeks ago
CODE_COMMENT_STYLE.md 734d572233 re-add comment style guide for merge (#4259) 7 months ago
CODE_OF_CONDUCT.md 42eb6a0719 Create CODE_OF_CONDUCT.md (#4216) 8 months ago
CONTRIBUTING.md 5683234b3a Correct test command. (#5539) 3 weeks ago
Cargo.lock 63cea640db update syn, proc-macro2 and quote version in match_template (#5653) 1 day ago
Cargo.toml 24ce8e093a upgrade criterion and use total instructions measurement (#5558) 4 days ago
Dockerfile ff82aa9eba Rustup to nightly-2019-09-05 (#5261) 1 month ago
GOVERNANCE.md 85bb786ea4 GOVERNANCE.md: fix the release version number check (#4803) 4 months ago
Jenkinsfile 1159ac6e78 Jenkinsfile: init adding Jenkinsfile (#1835) 2 years ago
LICENSE 661af2a4dd *: add license 3 years ago
MAINTAINERS.md 123282f748 Add @sunxiaoguang to MAINTAINERS.md (#4397) 6 months ago
Makefile 1d28db09b2 Pass tests on Mac OS (#5627) 19 hours ago
README.md 3ac0d78c0d update the WG slack link (#5530) 3 weeks ago
rust-toolchain ff82aa9eba Rustup to nightly-2019-09-05 (#5261) 1 month ago



Build Status Coverage Status CII Best Practices

TiKV is an open-source, distributed, and 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 ('Ti' stands for titanium) is inspired by some great distributed systems from Google, such as BigTable, Spanner, and Percolator, and some of the latest achievements in academia in recent years, such as the Raft consensus algorithm.

If you're interested in contributing to TiKV, or want to build it from source, see CONTRIBUTING.md.


TiKV is an incubating project of 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 has the following key features:

  • Geo-Replication

    TiKV uses Raft and the Placement Driver to support Geo-Replication.

  • Horizontal scalability

    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.

  • Coprocessor support

    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.


For instructions on deployment, configuration, and maintenance of TiKV, see our documentation on TiKV's wiki page or on our website. For more details on concepts and designs behind TiKV, see Deep Dive TiKV.


We are currently migrating our documentation from the TiKV's wiki page to the official website. We'd appreciate if you could check out the new look on the website and offer your feedback here. The Wiki page will be discontinued when the migration is finished. Stay tuned!

TiKV Adopters

You can view the list of TiKV Adopters.

TiKV Roadmap

You can see the TiKV Roadmap.

TiKV software stack

The TiKV software stack

  • Placement Driver: PD is the cluster manager of TiKV, which periodically checks replication constraints to balance load and data automatically.
  • Store: There is a RocksDB within each Store and it stores data into the local disk.
  • Region: Region is the basic unit of Key-Value data movement. Each Region is replicated to multiple Nodes. These multiple replicas form a Raft group.
  • Node: A physical node in the cluster. Within each node, there are one or more Stores. Within each Store, there are many Regions.

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.

Try TiKV

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.

Testing deployment

Production deployment

For the production environment, use Ansible to deploy the cluster.

Client drivers

Currently, the interfaces to TiKV are the TiDB Go client and the TiSpark Java client.

These are the clients for TiKV:

If you want to try the Go client, see Try Two Types of APIs.


Communication within the TiKV community abides by TiKV Code of Conduct. Here is an excerpt:

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

Social Media


Join the TiKV community on Slack - Sign up and join channels on TiKV topics that interest you.


The TiKV community is also available on WeChat. If you want to join our WeChat group, send a request mail to zhangyanqing@pingcap.com, with your personal information that includes the following:

  • WeChat ID (Required)
  • A contribution you've made to TiKV, such as a PR (Required)
  • Other basic information

We will invite you in right away.


TiKV is under the Apache 2.0 license. See the LICENSE file for details.


  • Thanks etcd for providing some great open source tools.
  • Thanks RocksDB for their powerful storage engines.
  • Thanks rust-clippy. We do love the great project.