All Projects → rqlite → Rqlite

rqlite / Rqlite

Licence: mit
The lightweight, distributed relational database built on SQLite

Programming Languages

go
31211 projects - #10 most used programming language
python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to Rqlite

Etcd
Distributed reliable key-value store for the most critical data of a distributed system
Stars: ✭ 38,238 (+318.04%)
Mutual labels:  database, consensus, distributed-database, raft, distributed-systems
Citus
Distributed PostgreSQL as an extension
Stars: ✭ 5,580 (-39%)
Mutual labels:  sql, database, distributed-database, relational-database
Copycat
A novel implementation of the Raft consensus algorithm
Stars: ✭ 551 (-93.98%)
Mutual labels:  database, consensus, raft, distributed-systems
Trino
Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
Stars: ✭ 4,581 (-49.92%)
Mutual labels:  sql, database, distributed-database, distributed-systems
Zookeeper
Apache ZooKeeper
Stars: ✭ 10,061 (+9.99%)
Mutual labels:  database, distributed-systems, consensus, distributed-database
Raft
Raft Consensus Algorithm
Stars: ✭ 370 (-95.95%)
Mutual labels:  consensus, distributed-database, raft, distributed-systems
Evolve
Database migration tool for .NET and .NET Core projects. Inspired by Flyway.
Stars: ✭ 477 (-94.79%)
Mutual labels:  sql, database, sqlite
Corfudb
A cluster consistency platform
Stars: ✭ 539 (-94.11%)
Mutual labels:  database, distributed-database, distributed-systems
Go Sqlbuilder
A flexible and powerful SQL string builder library plus a zero-config ORM.
Stars: ✭ 539 (-94.11%)
Mutual labels:  sql, database, sqlite
Yugabyte Db
The high-performance distributed SQL database for global, internet-scale apps.
Stars: ✭ 5,890 (-35.61%)
Mutual labels:  sql, database, distributed-database
Beekeeper Studio
Modern and easy to use SQL client for MySQL, Postgres, SQLite, SQL Server, and more. Linux, MacOS, and Windows.
Stars: ✭ 8,053 (-11.96%)
Mutual labels:  sql, database, sqlite
Avsqldebugger
A Simple Core Data Debugger that will look inside your apps DB
Stars: ✭ 30 (-99.67%)
Mutual labels:  sql, database, sqlite
Elasticell
Elastic Key-Value Storage With Strong Consistency and Reliability
Stars: ✭ 453 (-95.05%)
Mutual labels:  distributed-database, raft, distributed-systems
Cockroach
CockroachDB - the open source, cloud-native distributed SQL database.
Stars: ✭ 22,700 (+148.17%)
Mutual labels:  sql, database, distributed-database
Android Orma
An ORM for Android with type-safety and painless smart migrations
Stars: ✭ 442 (-95.17%)
Mutual labels:  sql, database, sqlite
Nuraft
C++ implementation of Raft core logic as a replication library
Stars: ✭ 428 (-95.32%)
Mutual labels:  consensus, raft, distributed-systems
Goqu
SQL builder and query library for golang
Stars: ✭ 984 (-89.24%)
Mutual labels:  sql, database, sqlite
Tidb
TiDB is an open source distributed HTAP database compatible with the MySQL protocol
Stars: ✭ 29,871 (+226.57%)
Mutual labels:  sql, database, distributed-database
Baikaldb
BaikalDB, A Distributed HTAP Database.
Stars: ✭ 707 (-92.27%)
Mutual labels:  sql, database, raft
Hraftd
A reference use of Hashicorp's Raft implementation
Stars: ✭ 732 (-92%)
Mutual labels:  consensus, raft, distributed-systems

Circle CI appveyor Go Report Card Release Docker Google Group

rqlite is a lightweight, distributed relational database, which uses SQLite as its storage engine. Forming a cluster is very straightforward, it gracefully handles leader elections, and tolerates failures of machines, including the leader. rqlite is available for Linux, macOS, and Microsoft Windows.

Check out the rqlite FAQ.

Why?

rqlite gives you the functionality of a rock solid, fault-tolerant, replicated relational database, but with very easy installation, deployment, and operation. With it you've got a lightweight and reliable distributed relational data store. Think etcd or Consul, but with relational data modelling also available.

You could use rqlite as part of a larger system, as a central store for some critical relational data, without having to run larger, more complex distributed databases.

Finally, if you're interested in understanding how distributed systems actually work, rqlite is a good example to study. Much thought has gone into its design and implementation, with clear separation between the various components, including storage, distributed consensus, and API.

How?

rqlite uses Raft to achieve consensus across all the instances of the SQLite databases, ensuring that every change made to the system is made to a quorum of SQLite databases, or none at all. You can learn more about the design here.

Key features

Quick Start

Detailed documentation is available. You may also wish to check out the rqlite Google Group.

The quickest way to get running on macOS and Linux is to download a pre-built release binary. You can find these binaries on the Github releases page. If you prefer Windows you can download the latest build here. Once installed, you can start a single rqlite node like so:

rqlited -node-id 1 ~/node.1

Setting -node-id isn't strictly necessary at this time, but highly recommended. It makes cluster management much clearer.

This single node automatically becomes the leader. You can pass -h to rqlited to list all configuration options.

Docker

docker run -p4001:4001 rqlite/rqlite

Homebrew

brew install rqlite

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:

rqlited -node-id 2 -http-addr localhost:4003 -raft-addr localhost:4004 -join http://localhost:4001 ~/node.2
rqlited -node-id 3 -http-addr localhost:4005 -raft-addr localhost:4006 -join http://localhost:4001 ~/node.3

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.

With just these few steps you've now got a fault-tolerant, distributed relational database. For full details on creating and managing real clusters, including running read-only nodes, check out this documentation.

Cluster Discovery

There is also a rqlite Discovery Service, allowing nodes to automatically connect and form a cluster. This can be much more convenient, allowing clusters to be dynamically created. Check out the documentation for more details.

Inserting records

Let's insert some records via the rqlite CLI, using standard SQLite commands. Once inserted, these records will be replicated across the cluster, in a durable and fault-tolerant manner. Your 3-node cluster can suffer the failure of a single node without any loss of functionality or data.

$ rqlite
127.0.0.1:4001> CREATE TABLE foo (id INTEGER NOT NULL PRIMARY KEY, name TEXT)
0 row affected (0.000668 sec)
127.0.0.1:4001> .schema
+-----------------------------------------------------------------------------+
| sql                                                                         |
+-----------------------------------------------------------------------------+
| CREATE TABLE foo (id INTEGER NOT NULL PRIMARY KEY, name TEXT)               |
+-----------------------------------------------------------------------------+
127.0.0.1:4001> INSERT INTO foo(name) VALUES("fiona")
1 row affected (0.000080 sec)
127.0.0.1:4001> SELECT * FROM foo
+----+-------+
| id | name  |
+----+-------+
| 1  | fiona |
+----+-------+

Data API

rqlite has a rich HTTP API, allowing full control over writing to, and querying from, rqlite. Check out the documentation for full details. There are also client libraries available.

Performance

You can learn more about rqlite performance, and how to improve it, here.

In-memory databases

By default rqlite uses an in-memory SQLite database to maximise performance. In this mode no actual SQLite file is created and the entire database is stored in memory. If you wish rqlite to use an actual file-based SQLite database, pass -on-disk to rqlite on start-up.

Does using an in-memory database put my data at risk?

No.

Since the Raft log is the authoritative store for all data, and it is stored on disk by each node, an in-memory database can be fully recreated on start-up from the information stored in the Raft log. Using an in-memory database does not put your data at risk.

Limitations

  • In-memory databases are currently limited to 2GiB (2147483648 bytes) in size. You can learn more about possible ways to get around this limit in the documentation.

  • Only SQL statements that are deterministic are safe to use with rqlite, because statements are committed to the Raft log before they are sent to each node. In other words, rqlite performs statement-based replication. For example, the following statement could result in a different SQLite database under each node:

INSERT INTO foo (n) VALUES(random());
  • This has not been extensively tested, but you can directly read the SQLite file under any node at anytime, assuming you run in "on-disk" mode. However there is no guarantee that the SQLite file reflects all the changes that have taken place on the cluster unless you are sure the host node itself has received and applied all changes.
  • In case it isn't obvious, rqlite does not replicate any changes made directly to any underlying SQLite file, when run in "on disk" mode. If you change the SQLite file directly, you may cause rqlite to fail. Only modify the database via the HTTP API.
  • SQLite dot-commands such as .schema or .tables are not directly supported by the API, but the rqlite CLI supports some very similar functionality. This is because those commands are features of the sqlite3 command, not SQLite itself.

Status and Diagnostics

You can learn how to check status and diagnostics here.

Backup and restore

Learn how to hot backup your rqlite cluster here. You can also load data directly from a SQLite dump file.

Security

You can learn about securing access, and restricting users' access, to rqlite here.

Google Group

There is a Google Group dedicated to discussion of rqlite.

Pronunciation?

How do I pronounce rqlite? For what it's worth I try to pronounce it "ree-qwell-lite". But it seems most people, including me, often pronouce it "R Q lite".

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].