Cette page est affichée en anglais. Une traduction française est en cours.
SkillsApr 16, 2026·3 min de lecture

rqlite — Distributed Database Built on SQLite & Raft

Lightweight distributed relational database that replicates SQLite across nodes using the Raft consensus protocol.

Prêt pour agents

Installation avec revue préalable

Cet actif nécessite une revue. Le prompt copié demande un dry-run, affiche les écritures, puis continue seulement après confirmation.

Needs Confirmation · 64/100Policy : confirmer
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
rqlite Raft SQLite
Commande avec revue préalable
npx -y tokrepo@latest install 44ddef49-3931-11f1-9bc6-00163e2b0d79 --target codex

Dry-run d'abord, confirmez les écritures, puis lancez cette commande.

TL;DR
rqlite replicates SQLite across nodes with Raft consensus for fault-tolerant distributed SQL.
§01

What it is

rqlite turns the battle-tested SQLite engine into a fault-tolerant distributed database. Each node wraps SQLite with the Raft consensus protocol, replicating writes to a cluster of 3, 5, or 7 nodes. It serves SQL over a simple HTTP/JSON API plus a native command-line shell.

rqlite is ideal when you want relational guarantees and easy operations without the complexity of running PostgreSQL or MySQL clusters. It ships as a tiny single-binary with no external dependencies.

§02

How it saves time or tokens

rqlite provides distributed SQL without the operational complexity of traditional database clusters. Starting a cluster takes three commands. Adding nodes requires a single join command. There is no external dependency (no ZooKeeper, no etcd). The HTTP/JSON API works with any language that can make HTTP requests, eliminating the need for database-specific drivers. Read consistency levels (none, weak, strong, linearizable) let you trade consistency for performance per request.

§03

How to use

  1. Start a 3-node cluster:
rqlited -node-id 1 -http-addr localhost:4001 \
  -raft-addr localhost:4002 ~/node1 &
rqlited -node-id 2 -http-addr localhost:4003 \
  -raft-addr localhost:4004 -join http://localhost:4001 ~/node2 &
rqlited -node-id 3 -http-addr localhost:4005 \
  -raft-addr localhost:4006 -join http://localhost:4001 ~/node3 &
  1. Write and read over HTTP:
curl -XPOST localhost:4001/db/execute \
  -d '[["CREATE TABLE foo (id INTEGER PRIMARY KEY, name TEXT)"]]'
curl -XPOST localhost:4001/db/execute \
  -d '[["INSERT INTO foo(name) VALUES(?)", "bar"]]'
curl -G localhost:4001/db/query \
  --data-urlencode 'q=SELECT * FROM foo'
  1. Check cluster status:
curl localhost:4001/status?pretty
§04

Example

Using rqlite with different read consistency levels:

# No consistency check (fastest, may read stale data)
curl -G localhost:4001/db/query \
  --data-urlencode 'q=SELECT * FROM foo' \
  --data-urlencode 'level=none'

# Weak consistency (confirms leader, no log check)
curl -G localhost:4001/db/query \
  --data-urlencode 'q=SELECT * FROM foo' \
  --data-urlencode 'level=weak'

# Strong consistency (verifies with Raft quorum)
curl -G localhost:4001/db/query \
  --data-urlencode 'q=SELECT * FROM foo' \
  --data-urlencode 'level=strong'
§05

Related on TokRepo

§06

Common pitfalls

  • Running a single-node rqlite cluster in production provides no fault tolerance. Deploy at least 3 nodes for automatic leader election and failover.
  • rqlite is not designed for high-throughput write workloads. Raft consensus adds latency to every write. Use it for configuration stores, metadata, and low-to-moderate write volumes.
  • SQLite limitations apply: no concurrent writers per node, limited data types, no stored procedures. rqlite inherits all SQLite constraints.

Questions fréquentes

What is Raft consensus?+

Raft is a consensus algorithm that ensures all nodes in a cluster agree on the same data. One node is elected leader, and writes are replicated to a majority of nodes before being committed. If the leader fails, a new leader is elected automatically.

How does rqlite differ from SQLite?+

SQLite is a single-file embedded database. rqlite wraps SQLite with Raft consensus to replicate data across multiple nodes, providing fault tolerance and a network-accessible HTTP API. rqlite adds distribution; SQLite provides the storage engine.

Can I use SQL drivers with rqlite?+

rqlite uses an HTTP/JSON API rather than the MySQL or PostgreSQL wire protocols. There are client libraries for Go, Python, and JavaScript that wrap the HTTP API. Standard SQL drivers for other databases will not work.

What consistency levels does rqlite support?+

rqlite offers four read consistency levels: none (fastest, may be stale), weak (confirms current leader), strong (Raft quorum verification), and linearizable (strongest, single-value semantics). Choose per query based on your requirements.

How many nodes should I run?+

Run an odd number of nodes (3, 5, or 7). A 3-node cluster tolerates 1 failure. A 5-node cluster tolerates 2. More nodes increase read capacity but add write latency due to Raft replication.

Sources citées (3)

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires