2.1. quasardb shell#
2.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.
2.1.2. Command line options#
Option
Usage
Default
display help
display quasardb version
run a qdb command
list available commands
cluster URI
qdb://127.0.0.1:2836
color output mode
automatic
path to the file containing the user’s security token used for connection
path to the file containing the public key of the cluster to connect to
2.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.
2.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.
2.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
2.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.
2.1.5.1. General#
Command |
Arguments |
Description |
---|---|---|
|
Display help page |
|
|
Exit the shell |
|
|
display version information of |
2.1.5.2. Administrative#
Command |
Arguments |
Description |
---|---|---|
|
|
compact the data in the persistence layer on the whole cluster. ‘full’ compacts all the data in a single operation, whereas ‘piecewise’ splits the data into multiple chunks and then compacts each separately. ‘full’ is faster, but requires more memory, cpu, and disk I/O |
|
disables the persistence automatic compaction on the cluster |
|
|
enables the persistence automatic compaction on the cluster |
|
|
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 |
2.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 |
|
|
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 |
2.1.5.5. Direct node interface#
Direct node communication is a collection of APIs that works on the specified node only. Each node has a local storage that can only be acceded through the direct node API. Statistics are, for example, stored in this local storage.
Command |
Arguments |
Description |
---|---|---|
|
|
set the node to connect to directly - by default th |
|
None |
return the URI of the node currently connected to |
|
|
return the blob value of the provided alias in the local key/value store of the node |
|
|
return the integer value of the provided alias in the local key/value store of the node |
|
|
return all keys matching the given prefix, up to the specified limit count |
|
|
triggers a node backup in the specified directory (accessible from the node) |
- -l, --list-commands#
List available commands.
- --cluster#
Cluster URI
- Argument
A string representing the URI of the cluster to connect to.
- Default value
qdb://127.0.0.1:2836
- --color-output#
Color output mode.
- Default value
automatic
- --user-security-file#
path to the file containing the user’s security token used for connection
- Argument
A string representing the path to the file containing the user’s security token.
- --cluster-public-key-file#
path to the file containing the public key of the cluster to connect to
- Argument
A string representing the path to the file containing the public key of the cluster.