rqlite provides robust replication for SQLite databases using the Raft consensus protocol. Coded in Go it ensures that all changes made to the leader SQLite database are replicated to all other nodes in the cluster, providing fault-tolerance and reliability.
It’s been 18 months since development of rqlite first started and it’s time for version 2.
New Raft consensus module
V1 of rqlite used go-raft as its Raft consensus module. However go-raft is no longer maintained, and it was time for a new module. I am quite familiar with the Hashicorp Raft consensus module due to my work with InfluxDB and hraftd, so swapping in that new module was straightforward.
This new Raft module also uses persistent TCP connections between the nodes; in contrast go-raft used HTTP requests and responses. The persistent connections lowers latency and increases throughput. Hashicorp Raft is used in production by many other systems, such as Consul and Nomad, and should provide enhanced stability and performance.
A better API
The API offered by version 1 was rather simplistic, and didn’t make it easy to build libraries on top of rqlite. Column order of returned results was not deterministic, and important information like last_insert_id was not available.
This has all been addressed in the new v2 API, and the changes should make it much easier to build libraries that use rqlite. A Python driver is already in development.
The rqlite API is documented via examples in the README. It explains how to read and write to the cluster, shows the format of the responses, and how to control such functionality as transactions.
The latest version of rqlite also supports backing up the database. A consistent snapshot of the SQLite database can be retrieved at any time, and used to restore a node later.
You can find the source code for rqlite, and instructions on how to build and deploy it, here on github. I hope to continue developing this software, as databases and distributed consensus systems are immensely interesting.