Configuration Files
Skytable supports custom configuration files to let users customize the functioning of Sky. Arguably, Sky has one of the simplest configuration files around. Skytable also allows configuration via command line arguments.
An example configuration
A configuration file is a TOML file, which has the following basic structure:
[server]
host = "127.0.0.1"
port = 2003
noart = false # optional
maxcon = 50000 # optional
[bgsave]
enabled = true
every = 120 # Every 120 seconds
This is the default configuration used by Sky when you don't specify a configuration file. Let's understand what each of the keys mean along with some other keys that can be used for more advanced configuration:
server
:host
: This is the IP address to which you want the database server to bind to. It can be any valid IPv4 or IPv6 address, as a quoted stringport
: This is the port to which you want Sky to bind tonoart
: This is an optional argument and is recommended for secure environments where displaying terminal artwork might cause problemsmaxcon
: Set the maximum number of clients that can query concurrently
bgsave
:enabled
: This is an optional key, which is to be set to true to enable BGSAVE or false to disable it. If this key is not specified, Sky will enable BGSAVE by defaultevery
: Run BGSAVEevery
seconds. So, for example, if you set this to 120, BGSAVE will run every two minutes. This is also an optional key, and if you don't provide it, the default BGSAVE duration of 120 seconds is used
snapshot
(OPTIONAL): This key can be used to configure snapshots and is not enabled by default. See this for more information.ssl
: This key can be used to configure SSL/TLS options. See this for more information.
Using a configuration file
To use a configuration file:
- Create it! We recommend you to name it as
skyd.toml
for easy identification - Start the database server with:
skyd -c /path/to/your/file.toml
- Done 🎉
If you're confused about creating a configuration file, we always recommend you to download a sample file from this link. Do note that this file is bleeding-edge and as a result will have new keys as they're created upstream.
That's all that's there for using configuration files!
Bonus tip
If you're using a custom host/port, then you can bind skysh
to a custom host/port by starting skysh
like:
skysh -h [HOST] -p [PORT]
You can do the same for sky-bench
:
sky-bench -h [HOST] -p [PORT]