Configuration Files

By using configuration files, you can customize the behavior of Skytable.

An example configuration

A configuration file is a TOML file, which has the following basic structure:

  1. [server]
  2. host = "127.0.0.1"
  3. port = 2003
  4. noart = false
  5. maxcon = 50000
  6. mode = "prod"
  7. [bgsave]
  8. enabled = true
  9. every = 120
  10. [snapshot]
  11. every = 3600
  12. atmost = 4
  13. failsafe = true
  14. [ssl]
  15. key = "/path/to/keyfile.pem"
  16. chain = "/path/to/chain.pem"
  17. port = 2004
  18. only = true

Let’s understand what each of the keys mean along with some other keys that can be used for more advanced configuration:

  • server (required):
    • 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 string
    • port: This is the port to which you want Sky to bind to
    • noart (optional): This is recommended for secure environments where displaying terminal artwork might cause problems
    • maxcon (optional): Set the maximum number of clients that can query concurrently
    • mode (optional): Should be set to prod for production deployments and dev during development
  • bgsave (optional):
    • enabled (optional): 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 default
    • every: Run BGSAVE everyseconds. 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 (optional): This key can be used to configure SSL/TLS options. See this for more information.

Using a configuration file

To use a configuration file:

  1. Create it! We recommend you to name it as skyd.tomlfor easy identification
  2. Start the database server with: skyd -c /path/to/your/file.toml
  3. Done 🎉

If you’re confused about creating a configuration file, we always recommend you to download the template configuration from this link.

That’s all that’s there to using configuration files!

Bonus tip

If you’re using a custom host/port, then you can bind skyshto a custom host/port by starting skyshlike:

  1. skysh -h [HOST] -p [PORT]

You can do the same for sky-bench:

  1. sky-bench -h [HOST] -p [PORT]

Using a configuration file with Docker containers

The official Docker image will look for a configuration file at /etc/skytable/skyd.toml within the container. To use a file on the host as the configuration file in the container, we’ll make use of Docker volumes. Simply follow the steps above and then start your docker image like this:

  1. docker run --name skyd \
  2. -v /path/to/your/file.toml:/etc/skytable/skyd.toml \
  3. skytable/sdb:v0.7.3