Utilities
Utility applications to interact with the database are provided. These are deployed to the /opt/spt/bin
directory.
Shell
The configsh
application provides a shell to interact with the database. The server should be running and the TCP port open for the application to connect.
The following command line options are supported by the shell:
-s | --server
The TCP server hostname to connect to. Defaultlocalhost
.-p | --port
The TCP port to connect to. Default2020
(2022
on Mac OS X).-t | --with-ssl
Flag to connect over SSL to the server.-l | --log-level
The level for the logger. Accepted valuesdebug|info|warn|critical
. Defaultinfo
.-o | --log-dir
The directory to write log files to. The path must end with a trailing/
. Default/tmp/
.
The following shows a simple CRUD type interaction via the shell.
CLI
The configctl
application provides a simple means for interacting with the database server. Use it to execute single actions against the service when required.
Note: Unlike the shell application, value
s specified as command line argument must be quoted if they contain spaces or other special characters.
The server should be running and the TCP port open for the application to connect.
The following command line options are supported by the CLI application:
-s | --server
The TCP server hostname to connect to. Defaultlocalhost
.-p | --port
The TCP port to connect to. Default2020
(2022
on Mac OS X).-t | --with-ssl
Flag to connect over SSL to the server.-l | --log-level
The level for the logger. Accepted valuesdebug|info|warn|critical
. Defaultinfo
.-o | --log-dir
The directory to write log files to. The path must end with a trailing/
. Default/tmp/
.-f | --file
The file to bulk import into the database. If specified, other commands are ignored.-a | --action
The action to perform. One ofget|set|move|delete|list
.-k | --key
The key to act upon.-v | --value
The value to set. Formove
this is the destination path.
See sample integration test suite.
The following shows a simple CRUD type interaction via the cli. These were using the default values for server [-s|--server]
and port [-p|--port]
options.
Bulk Import
A special -f | --file
option is supported for bulk importing key-value pairs from a file. The input file must contain lines where each line represents a key-value pair. The text before the first space character is interpreted as the key, and the rest of the line as the value.
Note: The entire file is imported as a single transaction. The input file must be small enough to buffer the requests and transaction in memory.
Seed
A seed-configdb
utility is provided to seed the database. This can be used to pre-populate the database before the service is started.
Note: This will fail if the service is already running (database locked by running process).
The following command line options are supported by the seed application:
-c | --conf
Optional JSON configuration file that controls the database storage location.-f | --file
The data file to import. The input file must contain lines where each line represents a key-value pair. The text before the first space character is interpreted as the key, and the rest of the line as the value.-l | --log-level
The level for the logger. Accepted valuesdebug|info|warn|critical
. Defaultinfo
.-o | --log-dir
The directory to write log files to. The path must end with a trailing/
. Default/tmp/
.