backends.mysql.server
server
This clause defines a MySQL or MariaDB server to connect to. A single backend can have multiple servers configured for high availability. Each server is identified by a unique name.
See Backend Load Balancing for further information.
Example configuration of a single server using a connection URL:
server "primary" {
url "mysql://radiator:secret@db.example.com:3306/radiator";
}
Example configuration using individual connection parameters (useful when credentials come from environment variables or when TLS is needed):
server "primary" {
host "db.example.com";
port 3306;
database "radiator";
username "radiator";
password "secret";
connections {
max 10;
idle_timeout 5m;
min 2;
min_timeout 1s;
min_retry 250ms;
}
}
Example configuration with TLS:
server "primary" {
host "db.example.com";
port 3306;
database "radiator";
username "radiator";
password "secret";
tls {
server_ca_certificate "MYSQL_CA";
}
}
Server Options
| Option | Required | Description |
|---|---|---|
url "..." | No | Full MySQL connection URL (alternative to individual options) |
host "..." | No | Database server hostname or IP address |
port N | No | Database server port. Default: 3306 |
database "..." | No | Database name to connect to |
username "..." | No | Username for authentication |
password "..." | No | Password for authentication |
connections { ... } | No | SQL connection pool configuration block. Use max, idle_timeout, min, min_timeout, and min_retry inside it. See connections. |
priority N | No | Server selection priority (0 = highest). Default: 0. Range: 0-255 |
tls { ... } | No | TLS configuration for encrypted connections |
service_level_objective { ... } | No | Health monitoring thresholds. See Service Level Objective. |
url
Specifies a complete MySQL connection URL as an alternative to specifying individual connection parameters.
MySQL URL format:
mysql://[username[:password]@][host][:port][/database][?param1=value1&...]
When url is specified, the other individual connection parameters (host, port, database, username, password) are ignored.
host
Hostname or IP address of the MySQL server.
port
TCP port of the MySQL server.
Default: 3306
database
Name of the database to connect to.
username
Username for database authentication.
password
Password for database authentication.
connections
connections {
max 25; # Maximum pool size.
idle_timeout 5m; # Idle connection timeout.
min 2; # Keep two connections ready.
min_timeout 1s; # Warm-pool maintenance probe timeout.
min_retry 250ms; # Delay between warm-pool maintenance retries.
}
Parameters:
max: Maximum pool size. Default:10.idle_timeout: Maximum time an idle connection stays in the pool before it is closed. Accepts duration units. Default:5m.min: Minimum number of connections Radiator keeps open at all times. Default:0.min_timeout: Maximum time Radiator waits for aminmaintenance probe to establish a connection before the probe is treated as failed. Accepts duration units. Default:1s.min_retry: Delay betweenminmaintenance probe attempts. Accepts duration units. Default:250ms.
min must not exceed max. min_timeout and min_retry only apply when min is greater than 0.
See connections and Backend Load Balancing.
priority
Controls server selection order when multiple servers are configured. Lower values indicate higher priority (0 = highest priority). With fallback or no_fallback, servers with equal priority are tried in alphabetical order by name.
Default: 0 Range: 0-255
See Backend Load Balancing for details and examples.
tls
Enables TLS for the connection to the MySQL server. See the certificates configuration reference for certificate and key setup details.
MySQL and MariaDB connections do not support Certificate Revocation List (CRL)
checks. The crl TLS option is ignored.
service_level_objective
Configures automatic health monitoring for the server. When the failure rate is exceeded, the server is marked as degraded and temporarily skipped during server selection. See the Service Level Objective documentation for details.
service_level_objective {
failure_rate 3/5;
initial_backoff_period 3s;
max_backoff_period 30s;
}
These are the default values. When server_selection is configured, they are applied
automatically to any server without an explicit service_level_objective block.