rqlite shell
How to access rqlite using the command-line tool
rqlite is a command line tool for interacting with a rqlite node. Consult the SQLite query language documentation for full details on the supported SQL syntax.
Usage
1. $> rqlite -h
2. Options:
4. -h, --help
5. display help information
7. -a, --alternatives
8. comma separated list of 'host:port' pairs to use as fallback
10. -s, --scheme[=http]
11. protocol scheme (http or https)
13. -H, --host[=127.0.0.1]
14. rqlited host address
16. -p, --port[=4001]
17. rqlited host port
19. -P, --prefix[=/]
20. rqlited HTTP URL prefix
22. -i, --insecure[=false]
23. do not verify rqlited HTTPS certificate
25. -c, --ca-cert
26. path to trusted X.509 root CA certificate
28. -u, --user
29. set basic auth credentials in form username:password
31. -v, --version
32. display CLI version
Example
Connecting to a host running locally and listing available commands:
1. $ rqlite
2. 127.0.0.1:4001> .help
3. .backup <file> Write database backup to SQLite file
4. .consistency [none|weak|strong] Show or set read consistency level
5. .dump <file> Dump the database in SQL text format to a file
6. .exit Exit this program
7. .expvar Show expvar (Go runtime) information for connected node
8. .help Show this message
9. .indexes Show names of all indexes
10. .nodes Show connection status of all nodes in cluster
11. .ready Show ready status for connected node
12. .remove <raft ID> Remove a node from the cluster
13. .restore <file> Restore the database from a SQLite database file or dump file
14. .schema Show CREATE statements for all tables
15. .status Show status and diagnostic information for connected node
16. .sysdump <file> Dump system diagnostics to a file for offline analysis
17. .tables List names of tables
18. 127.0.0.1:4001>
Inserting some data via standard SQLite syntax and then reading it back:
1. 127.0.0.1:4001> CREATE TABLE foo (id INTEGER NOT NULL PRIMARY KEY, name TEXT)
2. 0 row affected (0.000362 sec)
3. 127.0.0.1:4001> INSERT INTO foo(name) VALUES("fiona")
4. 1 row affected (0.000117 sec)
5. 127.0.0.1:4001> SELECT * FROM foo
6. +----+-------+
7. | id | name |
8. +----+-------+
9. | 1 | fiona |
10. +----+-------+
11. 127.0.0.1:4001> quit
12. bye~
Connecting to a host running somewhere else on the network:
1. $ rqlite -H 192.168.0.1 -p 8493
2. 192.168.0.1:8493>
Command history
Command history is stored and reloaded between sessions, in a hidden file in the user’s home directory named .rqlite_history. By default 100 previous commands are stored, though this value can be explicitly set via the environment variable RQLITE_HISTFILESIZE. If RQLITE_HISTFILESIZE is set to 0, no history file is written at all.
Last modified April 6, 2023: Update _index.md (4bfcaf1)
