Configuration
Sentinel uses KDL (a human-friendly document language) for configuration. This section covers all configuration options organized by component.
Configuration Blocks
| Block | Purpose |
|---|---|
| File Format | KDL syntax and file structure |
| Server | Worker threads, process management, shutdown |
| Listeners | Network binding, TLS, SNI, HTTP/2 |
| Routes | Request matching and routing rules |
| Upstreams | Backend pools, load balancing, health checks |
| Limits | Request limits, rate limiting, memory protection |
| Filters | Rate limiting, CORS, compression, geo-blocking |
| Caching | HTTP response caching configuration |
| Observability | Logging, metrics, and distributed tracing |
| Agents | External processing agent configuration |
Quick Example
server {
worker-threads 0
max-connections 10000
trace-id-format "tinyflake"
}
listeners {
listener "https" {
address "0.0.0.0:443"
protocol "https"
tls {
cert-file "/etc/sentinel/certs/server.crt"
key-file "/etc/sentinel/certs/server.key"
min-version "1.2"
}
}
}
routes {
route "api" {
priority 100
matches {
path-prefix "/api/"
}
upstream "backend"
filters "rate-limit" "cors"
cache {
enabled #true
default-ttl-secs 60
}
}
}
upstreams {
upstream "backend" {
targets {
target { address "10.0.1.1:8080" }
target { address "10.0.1.2:8080" }
}
load-balancing "round_robin"
health-check {
type "http" {
path "/health"
expected-status 200
}
}
}
}
filters {
filter "rate-limit" {
type "rate-limit"
max-rps 100
burst 20
key "client-ip"
}
filter "cors" {
type "cors"
allowed-origins "https://example.com"
allowed-methods "GET" "POST" "PUT" "DELETE"
}
}
cache {
enabled #true
backend "memory"
max-size 104857600
}
observability {
logging {
level "info"
format "json"
}
metrics {
enabled #true
address "0.0.0.0:9090"
}
}
limits {
max-body-size-bytes 10485760
}
Validation
Always validate configuration before applying:
Hot Reload
Reload configuration without restart:
# or