Embeddable, replicated and fault tolerant SQL engine.
  • C 91.5%
  • M4 7.9%
  • Makefile 0.4%
  • Dockerfile 0.2%
Find a file
Free Ekanayaka 7c4d731519
Fix -Wdiscarded-qualifiers warnings when using C23 memchr (#46)
The pointers `p`, `version_str`, `addr` and `id_str` are not really
const, so remove the const specifier.

Fixes #44.
2026-04-29 08:01:37 +01:00
.github build(deps): bump actions/checkout from 5 to 6 2025-11-24 22:21:09 +00:00
ac Move C code to top-level dir 2018-07-30 19:09:02 +00:00
doc Use correct URL to project website 2020-08-03 17:34:03 -04:00
docs docs: Fix requirements.txt typo 2023-09-21 14:34:19 +01:00
include Release 1.15.6 2024-03-29 10:30:47 +00:00
m4 fix: de-duplicate m4 macros in acinclude.m4 and m4/ 2020-08-04 09:00:58 +02:00
src Fix -Wdiscarded-qualifiers warnings when using C23 memchr 2026-04-28 20:48:10 +02:00
test test: Disable more flaky integration tests on slow architectures 2025-02-02 09:01:32 +00:00
.clang-format Render instance name in struct config 2019-06-23 20:06:20 +02:00
.dir-locals.el Rename dqlite to dqlite_task 2019-08-24 16:45:40 +02:00
.gitignore docs: Require sphynx 1.8 2023-09-21 14:22:07 +01:00
.readthedocs.yaml docs: Update requirements 2023-09-21 14:30:57 +01:00
AUTHORS AUTHORS: Update to refer to git 2021-11-04 18:05:35 -04:00
configure.ac Release v1.15.9 2025-07-11 10:47:03 +01:00
cowsql.pc.in Rebrand all source code symbols to cowsql 2023-08-09 21:06:23 +01:00
Dockerfile Rebrand all source code symbols to cowsql 2023-08-09 21:06:23 +01:00
LICENSE [doc] LICENSE: Update copyright notice 2023-08-09 16:48:48 +01:00
Makefile.am Remove disk mode 2023-09-09 00:19:33 +01:00
README.md README: Fix PPA name 2024-01-29 11:46:31 -05:00
README_CH.md Added chinese translation of fork annoucement 2023-11-26 10:26:04 +08:00
VERSION Publish pre-built release tarballs on Github 2018-07-30 19:17:24 +00:00

cowsql Tests codecov Documentation Status

English|简体中文

cowsql (/ˈkaʊ,siːkwəl/ listen) is a C library that implements an embeddable and replicated SQL database engine with high availability and automatic failover.

cowsql extends SQLite with a network protocol that can connect together various instances of your application and have them act as a highly-available cluster, with no dependency on external databases.

The name "cowsql" loosely refers to the "pets vs. cattle" concept, since it's generaly fine to delete or rebuild a particular node of an application that uses cowsql for data storage.

Fork of Canonical dqlite

cowsql is a fork of Canonical's dqlite project, which was originally written by cowsql's author himself while working at Canonical.

Design highlights

  • Asynchronous single-threaded implementation using libuv as event loop.
  • Custom wire protocol optimized for SQLite primitives and data types.
  • Data replication based on the Raft algorithm and its efficient C-raft implementation.

License

The cowsql library is released under a slightly modified version of LGPLv3, that includes a copyright exception allowing users to statically link the library code in their project and release the final work under their own terms. See the full license text.

Compatibility

cowsql runs on Linux and requires a kernel with support for native async I/O (not to be confused with POSIX AIO), which is used by the libuv backend of C-raft.

Try it

The simplest way to see cowsql in action is to use the demo program that comes with the Go cowsql bindings. Please see the relevant documentation in that project.

Media

There's no video about cowsql itself yet, but a talk about dqlite was given at FOSDEM 2020, you can watch it here.

Here is a blog post from 2022 comparing dqlite with rqlite and Litestream, other replication software for SQLite. It largly applies to cowsql too.

Wire protocol

If you wish to write a client, please refer to the wire protocol documentation.

Install

If you are on a Debian-based system, you can get the latest development release from cowsql's dev PPA:

sudo add-apt-repository ppa:cowsql/main
sudo apt-get update
sudo apt-get install libcowsql-dev

Build

To build libcowsql from source you'll need:

  • A reasonably recent version of libuv (v1.8.0 or beyond).
  • A reasonably recent version of sqlite3-dev
  • A build of the C-raft Raft library.

Your distribution should already provide you with a pre-built libuv shared library and libsqlite3-dev.

To build the raft library:

git clone https://github.com/cowsql/raft.git
cd raft
autoreconf -i
./configure
make
sudo make install
cd ..

Once all the required libraries are installed, in order to build the cowsql shared library itself, you can run:

autoreconf -i
./configure
make
sudo make install