Quick start

Get up and running quickly with rqlite

The quickest way to get running is to download a pre-built release binary, available on the GitHub releases page. Once installed, you can start a single rqlite node like so:

  1. $ rqlited -node-id 1 node1

Once launched rqlite will be listening on http://localhost:4001.

Inserting records

Let’s insert some records using the rqlite shell, using standard SQLite commands.

  1. $ rqlite
  2. 127.0.0.1:4001> CREATE TABLE foo (id INTEGER NOT NULL PRIMARY KEY, name TEXT)
  3. 0 row affected (0.000668 sec)
  4. 127.0.0.1:4001> .schema
  5. +-----------------------------------------------------------------------------+
  6. | sql |
  7. +-----------------------------------------------------------------------------+
  8. | CREATE TABLE foo (id INTEGER NOT NULL PRIMARY KEY, name TEXT) |
  9. +-----------------------------------------------------------------------------+
  10. 127.0.0.1:4001> INSERT INTO foo(name) VALUES("fiona")
  11. 1 row affected (0.000080 sec)
  12. 127.0.0.1:4001> SELECT * FROM foo
  13. +----+-------+
  14. | id | name |
  15. +----+-------+
  16. | 1 | fiona |
  17. +----+-------+

Forming a cluster

While not strictly necessary to run rqlite, running multiple nodes means you’ll have a fault-tolerant cluster. Start two more nodes, allowing the cluster to tolerate failure of a single node, like so:

  1. $ rqlited -node-id 2 -http-addr localhost:4003 -raft-addr localhost:4004 -join localhost:4002 node2
  2. $ rqlited -node-id 3 -http-addr localhost:4005 -raft-addr localhost:4006 -join localhost:4002 node3

This demonstration shows all 3 nodes running on the same host. In reality you probably wouldn’t do this, and then you wouldn’t need to select different -http-addr and -raft-addr ports for each rqlite node. Consult the Clustering Guide for more details.

If running software older than 8.0 you must pass the HTTP address of the node you wish to join. In the example above you would pass http://localhost:4001.

With just these few steps you’ve now got a fault-tolerant, distributed relational database. Running on each rqlite node will be a fully-replicated copy of the SQLite database. Any data you insert will be replicated across the cluster, in a durable and fault-tolerant manner.

Next steps

Take a look at the Developer Guide, and check out the detailed guides for clustering and Kubernetes.

Last modified December 5, 2023: Create 8.0 docs (4131b5a)