1.1. quasardb shell¶
1.1.1. Introduction¶
The quasardb shell is a command line tool that enables you to interact with a quasardb node or cluster. The shell can be used interactively and non-interactively. In interactive mode, the user enters commands to be executed on the node. Feedback is provided to indicate failure. In non-interactive mode, a single command - supplied as a parameter - is executed and the program exits.
By default qdbsh will attempt to connect in interactive mode to a qdbd daemon running on 127.0.0.1:2836. If this is not the case - for example if your qdbd daemon runs on 192.168.1.1 and listens on the default port 2836 - you will need to pass the address and port as a qdb://
URI string, shown below:
$ qdbsh qdb://192.168.1.1:2836
If you wish to connect to a secure cluster, you can use the following command:
$ qdbsh --cluster qdb://192.168.1.1:2836 \
--cluster-public-key-file /usr/share/qdb/cluster_public.key \
--user-security-file /path/to/my/security.key
You will need to replace the locations of the cluster public key file /usr/share/qdb/cluster_public.key
and your user security file /path/to/my/security.key
with those provided by your system administration. Please refer to our security documentation for more information.
1.1.2. Command line options¶
Option
Usage
Default
display help
display quasardb version
run a qdb command
-l
,--list-commands
list available commands
--cluster
cluster URI
qdb://127.0.0.1:2836
--color-output
color output mode
automatic
--user-security-file
path to the file containing the user’s security token used for connection
--cluster-public-key-file
path to the file containing the public key of the cluster to connect to
1.1.3. Interactive mode¶
Use qdbsh
interactive mode to enter as many commands as needed. The shell provides you with feedback upon success and failure or displays the content of retrieved entries.
Unless otherwise specified, qdbsh
assumes the daemon is running on localhost and on the port 2836.
Once qdbsh has connected to a cluster, the following prompt is displayed:
qdbsh >
This means the shell is ready to accept commands. Only one command at a time may be specified.
A command is executed as soon as Enter is pressed and cannot be canceled or rolled back.
To exit the shell, enter the command exit
. To list the available commands, type help
. For the list of supported commands, see Command reference.
If you are looking for an example usage, please refer to the QuasarDB primer which uses an interactive qdbsh
session to guide you through the first steps.
1.1.4. Non-interactive mode¶
Use qdbsh
non-interactive mode to run one command without waiting for any input.
Non-interactive mode supports standard input and output and can be integrated in a tool chain à la Unix.
Performance-wise, non-interactive mode implies establishing and closing a connection to the quasardb cluster every time the qdbsh
executable is run.
The command to be executed is supplied as an argument to the -c
parameter.
For the list of supported commands, see Command reference.
When successful, the result of the command will be printed on the standard output stream and the shell will exit with the code 0. Most commands produce no output when successful (silent success).
In case of error, the shell will output an error message on the standard error output stream and will exit with the code 1.
1.1.4.1. Examples¶
Unless otherwise specified, qdbsh assumes the daemon is running on localhost and on the port 2836.
Save the content of a Blob named “biography” in a text file named “biography.txt”:
qdbsh -c blob_get biography > biography.txt
Compress a file named “myfile”, then add its content to an entry named “myfile” on the quasardb node at 192.168.1.1:
bzip2 -c myfile | qdbsh qdb://192.168.1.1:2836 -c blob_put myfile
1.1.5. Command reference¶
If you want to use qdbsh
in conjunction with our SQL query language, you can just use them directly from the QuasarDB shell.
In addition to these timeseries-oriented commands, qdbsh
also supports the key/value API and more administrative commands which are described below.
1.1.5.1. General¶
Command |
Arguments |
Description |
---|---|---|
|
Display help page |
|
|
Exit the shell |
|
|
display version information of |
1.1.5.2. Administrative¶
Command |
Arguments |
Description |
---|---|---|
|
remove ALL entries on the WHOLE cluster (dangerous!) |
|
|
remove ALL cached data on the WHOLE cluster |
|
|
remove unused versions of entries from the cluster |
|
|
|
wait for the stabilization of the cluster |
|
|
print status information about a cluster |
|
|
return the node configuration as a JSON string |
|
|
return the node status as a JSON string |
|
|
shut down the quasardb daemon on a host |
|
|
return the node topology as a JSON string |
1.1.5.3. Tags¶
Command |
Arguments |
Description |
---|---|---|
|
|
add a tag to an entry |
|
|
add tags to an entry |
|
|
remove a tag from an entry |
|
|
remove tags from an entry |
|
|
get entries with the given tag |
|
|
get an approximate count of entries with the given tag |
|
|
get tags for the given entry |
|
|
return true if the entry has the tag |
1.1.5.4. Key/Value¶
Command |
Arguments |
Description |
---|---|---|
|
find key/value entries that match certain parameters |
|
|
|
return aliases of all entries with aliases starting with the given prefix |
|
|
return aliases of all entries with aliases ending with the given suffix |
|
|
remove the entry from the cluster |
|
|
return the metainformation about the entry |
|
|
return the type of the entry |
|
|
atomically compare and swap the Blob with the comparand |
|
|
return the content of the Blob |
|
|
atomically get and update the Blob |
|
|
create a new Blob; fails if Blob already exists |
|
|
remove the Blob if the value matches the comparand |
|
|
scan ALL blobs on the WHOLE cluster for the given pattern |
|
|
scan ALL blobs on the WHOLE cluster for the given regular expression pattern |
|
|
update an existing Blob or creates a new Blob |
|
|
atomically increment the Integer by the value |
|
|
return the value of the Integer |
|
|
create a new Integer; fails if Integer already exists |
|
|
update an existing Integer or create a new Integer |
|
|
return the value at the back of the Deque |
|
|
return the value at the front of the Deque |
|
|
remove and return the value from the back of the Deque |
|
|
remove and return the value from the front of the Deque |
|
|
add a value to the back of the Deque |
|
|
add a value to the front of the Deque |
|
|
return the size of the Deque |
|
|
set the absolute expiry time of the entry |
|
|
set the expiry time of the entry to seconds relative to now |
|
|
return the absolute expiry time of the entry |