A lightweight, fault-tolerant distributed relational database built on SQLite, replicated across nodes via Raft consensus.
cockroachdb/cockroach
A cloud-native distributed SQL database built on a strongly-consistent key-value store, with PostgreSQL wire protocol compatibility.
Open-source alternative to:Amazon Aurora
Google Cloud Spanner
- Stars
- 32,575
- Forks
- 4,160
- Open issues
- 8,226
- Last commit
- 4 hours ago
What is it?
CockroachDB is a distributed SQL database that stores data across a cluster of machines while presenting a familiar SQL interface. It scales horizontally by adding nodes, and it is designed to keep running through disk, machine, rack, or datacenter failures without manual intervention.
The database provides strongly-consistent ACID transactions on top of a transactional key-value store. Data replication and automatic rebalancing are built in, and operators can control where data is placed across the cluster.
Because it speaks the PostgreSQL wire protocol, applications can connect using existing PostgreSQL drivers and many ORMs. The project also offers CockroachCloud, a managed hosted option, alongside self-managed deployment on multiple machines, cloud platforms, and orchestration systems.
Key features
- 01Horizontal scaling by adding nodes to a cluster
- 02Strongly-consistent ACID transactions over a distributed key-value store
- 03Survives disk, machine, rack, and datacenter failures with automatic replication
- 04PostgreSQL wire protocol compatibility for existing drivers and ORMs
- 05Control over data placement across the cluster
- 06Built-in SQL client for interactive use
Use cases
- Building data-intensive applications that need high availability across failures
- Running a globally or multi-region distributed SQL backend
- Migrating PostgreSQL-based applications to a horizontally scalable database
- Hosting a managed database through CockroachCloud without operating a cluster yourself
Quick start
- 1
Install CockroachDB using a pre-built executable from the install docs
- 2
Start a local cluster following the official guide
- 3
Connect via the built-in SQL client and learn CockroachDB SQL
Things to know
- The license is the CockroachDB Software License for versions from v24.3 onward, not a standard open-source license.
- Building from source is documented on an external wiki and requires a substantial Go toolchain setup.
Topics
FAQ
- What is cockroach?
- A cloud-native distributed SQL database built on a strongly-consistent key-value store, with PostgreSQL wire protocol compatibility. CockroachDB is a distributed SQL database that stores data across a cluster of machines while presenting a familiar SQL interface. It scales horizontally by adding nodes, and it is designed to keep running through disk, machine, rack, or datacenter failures without manual intervention.
- Is cockroach free to use? What license does it have?
- cockroach is open source under the Other license. Check the license terms before using it in commercial products.
- Is cockroach still maintained?
- Actively maintained. The last commit to cockroach was on Oct 21, 2026.
- What can I use cockroach for?
- Building data-intensive applications that need high availability across failures Running a globally or multi-region distributed SQL backend Migrating PostgreSQL-based applications to a horizontally scalable database Hosting a managed database through CockroachCloud without operating a cluster yourself
- How do I install cockroach?
- Install CockroachDB using a pre-built executable from the install docs Start a local cluster following the official guide Connect via the built-in SQL client and learn CockroachDB SQL
- Where can I get cockroach?
- The source code and installation instructions are on GitHub: https://github.com/cockroachdb/cockroach
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
TypeScript ORM for Node.js that gives type-safe database access across PostgreSQL, MySQL, SQLite, MongoDB and other databases.
Open-source distributed SQL database with MySQL 8.0 compatibility, ACID transactions, HTAP analytics, and vector search.
Cross-platform SQL editor and database manager for Linux, macOS, and Windows, supporting MySQL, PostgreSQL, SQLite, SQL Server and many more.
A CLI and Go library for managing database schema changes through versioned SQL files or Go functions.
A full-featured ORM for Go that maps structs to database tables and supports associations, hooks, transactions and migrations.