The programs
The three programs of Raft DB (raftdb-server, raftdb-mysql, raftdb-watch), their command lines, exit codes and how the settings sources are combined.
| Program | What it does | Settings come from |
|---|---|---|
raftdb-server | The database server: binary protocol, HTTP/JSON API, the Studio's files, replication. | Command line, environment, raftdb.conf, profile defaults. |
raftdb-mysql | The SQL front-end for MySQL and MariaDB clients. Optionally runs the server in the same process. | Command line and a key = value file. |
raftdb-watch | Checks a server, restarts it, reports, and runs the cluster control plane. | A key = value file and --key=value arguments. |
raftdb-server#
Syntax#
raftdb-server [--config FILE] [--profile single|primary|replica] [--print-config | --check-config] [--SETTING VALUE]...
raftdb-server init [--profile NAME] [--out FILE]
raftdb-server install-service [--profile NAME] [--config FILE] [--user NAME] [--no-start] [--print]
raftdb-server uninstall-serviceCommands and options#
| Form | Meaning |
|---|---|
| (no arguments) | A secure single server: loopback only (127.0.0.1:7480), data in the standard place, an admin account with a generated password. |
--config FILE | The settings file. Without it the program looks at RAFTDB_CONFIG, then ./raftdb.conf, then %ProgramData%\RaftDB\raftdb.conf (Windows) or /etc/raftdb/raftdb.conf (elsewhere). |
--profile NAME | single (default), primary or replica. Also RAFTDB_PROFILE or profile = in the file. |
--print-config | Prints every setting that is set, where it came from (command line, environment, file, profile), with token, user, replica-user and replica-token shown as ***. Starts nothing. |
--check-config | Validates the settings and the profile's rules, writes nothing, prints configuration ok (profile NAME). |
--SETTING VALUE | Any setting of raftdb-server settings. udp, open, allow-remote-servers and control may be given without a value and then mean true. |
init [--profile NAME] [--out FILE] | Writes a minimal settings file (default raftdb.conf) for the profile. It never overwrites an existing file and never asks a question. |
install-service | Installs the server so it starts at boot: a systemd unit on Linux, a startup task on Windows. --print shows the plan without needing administrator rights. See Running as a service. |
uninstall-service | Removes the unit or task; data and settings stay. |
--help | Prints the usage lines and exits with code 2. |
Order in which sources win#
For each name the first of these wins: command line, environment (RAFTDB_ plus the name in upper case with - as _, for example RAFTDB_SYNC_REPLICAS), file, profile defaults. A name that may be given more than once (user, cors) is taken whole from the first source that has it; in the environment its values are separated by ;. A name that is not a setting is an error in the file and on the command line, so a misspelling is never ignored.
Exit codes#
| Code | Meaning |
|---|---|
| 0 | Normal stop (after seconds), a successful --print-config, --check-config or init. |
| 1 | The server could not start (the reason is printed and a fatal-error report is written), or init found the file already there. |
| 2 | A usage error or an invalid setting. |
Output#
At start the server prints one line: raftdb-server listening on ADDR (binary protocol and HTTP, Studio at /), data in DIR. It runs until the process is stopped; there is no log file option: standard output and standard error are the logs (see Logs and tracing).
raftdb-mysql#
Syntax#
raftdb-mysql --config FILE
raftdb-mysql [--listen HOST:PORT] [--raftdb HOST:PORT] [--raftdb-user NAME] [--raftdb-password-file FILE] [--user NAME:PASSWORD]... [--KEY VALUE]...Every key of the file can be given as --key value; dashes and underscores are the same (--raftdb-user is raftdb_user). The settings are in raftdb-mysql settings. There is no --print-config or --check-config.
Exit codes#
0 after --help; 2 for any error (an unknown setting, a missing user, a port in use, a failure to start the embedded server). The message is printed as raftdb-mysql: MESSAGE.
Output#
On start it prints (to standard error) raftdb-mysql: listening on ADDR (mysql protocol), version 8.0.36-Raft DB (or mariadb and 11.4.13-MariaDB-Raft DB), and with embed also raftdb-mysql: Raft DB server running in this process, listening on ADDR (binary protocol and HTTP).
raftdb-watch#
Syntax#
raftdb-watch --config watch.conf run until stopped
raftdb-watch --config watch.conf --once one round; exit 0 healthy, 1 warning, 2 critical
raftdb-watch --config watch.conf --test-notify send a test report through every channel
raftdb-watch --config watch.conf --check-config print the settings it understoodAny key can be given as --key=value and overrides the file. The settings and what the watcher checks are in Monitoring with the watcher.
Environment variables read by the programs#
| Variable | Read by | Meaning |
|---|---|---|
RAFTDB_CONFIG | raftdb-server | Settings file. |
RAFTDB_PROFILE | raftdb-server | Profile. |
RAFTDB_<SETTING> | raftdb-server (and the embedded server of raftdb-mysql) | Any setting, for example RAFTDB_SHARDS. |
RAFTDB_MYSQL_TRACE | raftdb-mysql | Any value switches on a log line for every login and every statement. |
RAFTDB_MYSQL_PROF | raftdb-mysql | Any value prints where each statement's time goes. |
RAFTDB_ERROR_REPORT, RAFTDB_ERROR_REPORT_DIR, RAFTDB_ERROR_REPORT_URL, RAFTDB_ERROR_REPORT_TOKEN, RAFTDB_ERROR_REPORT_COMMAND, RAFTDB_ERROR_REPORT_DETAIL | all programs | Fatal-error reports; see Logs and tracing. |