Skip to content
Embeddable, replicated and fault tolerant SQL engine.
C M4 C++ Other
Branch: master
Clone or download

README.md

dqlite Build Status codecov

dqlite is a C library that implements an embeddable and replicated SQL database engine with high-availability and automatic failover.

The acronym "dqlite" stands for "distributed SQLite", meaning that dqlite 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.

Design higlights

  • 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.

Try it

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

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 the latest stable release from dqlite's v1 PPA:

sudo add-apt-repository ppa:dqlite/v1
sudo apt-get update
sudo apt-get install libdqlite-dev

Build

To build libdqlite from source you'll need:

Your distribution should already provide you a pre-built libuv shared library.

To build the other libraries:

git clone --depth 100 https://github.com/canonical/sqlite.git
cd sqlite
./configure --enable-replication
make
sudo make install
cd ..
git clone https://github.com/canonical/libco.git
cd libco
make
sudo make install
cd ..
git clone https://github.com/canonical/raft.git
cd raft
autoreconf -i
./configure
make
sudo make install
cd ..

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

autoreconf -i
./configure
make
sudo make install
You can’t perform that action at this time.