From 8c1ee241927ef48adc80fffbf331fe4261fbc78a Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Thu, 24 Nov 2016 09:28:35 -0800 Subject: [PATCH] Document restoring from SQLite dump file --- doc/RESTORE_FROM_SQLITE.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 doc/RESTORE_FROM_SQLITE.md diff --git a/doc/RESTORE_FROM_SQLITE.md b/doc/RESTORE_FROM_SQLITE.md new file mode 100644 index 00000000..9f8950b5 --- /dev/null +++ b/doc/RESTORE_FROM_SQLITE.md @@ -0,0 +1,28 @@ +# Restoring from a SQLite dump file + +rqlite supports loading a cluster directly from a SQLite dump file. This is a fast and efficient manner to bootstrap a system from an existing SQLite database. An example restore is shown below. _Please note that this functionality is currently experimental._ + +## Example +The following example shows a trivial database being generated by sqlite3, dumped to a file, and then loaded into an rqlite node listening on localhost. +```bash +~ $ sqlite3 restore.sqlite +SQLite version 3.14.1 2016-08-11 18:53:32 +Enter ".help" for usage hints. +sqlite> CREATE TABLE foo (id integer not null primary key, name text); +sqlite> INSERT INTO "foo" VALUES(1,'fiona'); +sqlite> +~ $ echo '.dump' | sqlite3 restore.sqlite > restore.dump +~ $ curl -XPOST localhost:4001/db/load --data-binary @restore.dump +~ $ echo '.dump' | sqlite3 restore.sqlite > restore.dump +``` + +Let's connect to the node, and check that the data has been loaded correctly. +```bash +$ rqlite +127.0.0.1:4001> SELECT * FROM foo ++----+-------+ +| id | name | ++----+-------+ +| 1 | fiona | ++----+-------+ +```