https://github.com/rqlite/rqlite Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Project management - + Integrations - + GitHub Sponsors - + Customer stories - + Security - * Team * Enterprise * Explore + Explore GitHub - Learn & contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Nonprofit - + Education - [ ] [search-key] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} rqlite / rqlite * Watch 207 * Star 6.7k * Fork 365 The lightweight, distributed relational database built on SQLite. www.rqlite.com/ MIT License 6.7k stars 365 forks Star Watch * Code * Issues 44 * Pull requests 8 * Discussions * Actions * Security * Insights More * Code * Issues * Pull requests * Discussions * Actions * Security * Insights master 12 branches 53 tags Go to file Code Clone HTTPS GitHub CLI [https://github.com/r] Use Git or checkout with SVN using the web URL. [gh repo clone rqlite] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio If nothing happens, download the GitHub extension for Visual Studio and try again. Go back Latest commit @otoolep otoolep Update FAQ.md ... 478a0fa Jan 22, 2021 Update FAQ.md 478a0fa Git stats * 1,904 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .circleci Move to go1.14 May 4, 2020 DOC Update FAQ.md Jan 22, 2021 auth Add varadic functions to auth store Dec 28, 2019 aws More package-level GoDoc Jul 6, 2017 cluster Revert "Merge pull request #697 from rqlite/hosts-not-ips" Nov 29, 2020 cmd rqlite dumps rqlite node version at startup Jan 5, 2021 command Better command decoding panic message Jan 5, 2021 db Add SQLite database page-centric size to status output Dec 28, 2020 disco Revert client comment Nov 28, 2019 http Include more information with HTTP 500 Dec 28, 2020 store Count number of legacy commands unmarshaled Jan 5, 2021 system_test End-to-end test of idempotent join Dec 27, 2020 tcp Check for nil ln during Close() Nov 11, 2020 testdata Support directory path for temp test x509 files Sep 25, 2020 .gitignore Ignore rqbench binaries Nov 2, 2017 CHANGELOG.md Update CHANGELOG.md Jan 5, 2021 CONTRIBUTING.md Update CONTRIBUTING.md Jan 6, 2021 LICENSE Update years Jan 12, 2021 README.md Use macOS instead of OSX Jan 22, 2021 Vagrantfile Move to clearer command-line options Jun 13, 2017 appveyor.yml Move to Hashicorp Raft v1 Dec 19, 2019 doc.go Better top-level GoDoc Dec 19, 2017 go.mod Enable http/2.0 support for TLS Dec 27, 2020 go.sum Enable http/2.0 support for TLS Dec 27, 2020 gofmt.sh Add script to check 'go fmt' status Mar 15, 2016 package.sh Include rqbench in the released package Dec 2, 2019 vagrant_setup.sh Move to go1.14 Nov 20, 2020 View code README.md [logo-text] Circle CI appveyor GoDoc 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 * Trivially easy to deploy, with no need to separately install SQLite. * Fully replicated production-grade SQL database. * Production-grade distributed consensus system. * An easy-to-use HTTP(S) API, including leader-redirection and bulk-update support. A command-line interface is also available, as are various client libraries. * Discovery Service support, allowing clusters to be dynamically created. * Extensive security and encryption support, including node-to-node encryption. * Choice of read consistency levels. * Optional read-only (non-voting) nodes, which can add read scalability to the system. * A form of transaction support. * Hot backups. 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 Alternatively you can pull the latest release via docker pull rqlite/ 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 rqlite replicates SQLite for fault-tolerance. It does not replicate it for performance. In fact performance is reduced somewhat due to the network round-trips. Depending on your machine (particularly its IO performance) and network, individual INSERT performance could be anything from 10 operations per second to more than 200 operations per second. However, by using the bulk API, transactions, or both, throughput will increase significantly, often by 2 orders of magnitude. This speed-up is due to the way Raft and SQLite work. So for high throughput, execute as many operations as possible within a single transaction. 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 written to disk by each node, an in-memory database can be fully recreated on start-up. Using an in-memory database does not put your data at risk. Limitations * 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()); * Technically this is not supported, but you can directly read the SQLite 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 will 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". About The lightweight, distributed relational database built on SQLite. www.rqlite.com/ Topics go distributed-systems sql database sqlite raft consensus distributed-database relational-database Resources Readme License MIT License Releases 53 v5.8.0 Latest Dec 29, 2020 + 52 releases Packages 0 No packages published Contributors 25 * * * * * * * * * * * + 14 contributors Languages * Go 92.4% * Python 6.7% * Shell 0.9% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.