Skip to main content
Installation

Multi-node and high availability

Manage several data plane nodes from one control plane. Enable node access, create credentials and join tokens, install nodes, run the data plane active/active behind health checks, share counters, and use mirror inspection nodes.

A multi-node deployment consists of one control plane and several data plane nodes. Nodes open TLS connections to the control plane, send heartbeats, pull signed configuration snapshots and send their logs back; the control plane never needs to reach the nodes. Multi-node needs a Standard or higher licence, or the add-on; see Editions. The licence is issued to the control plane, and nodes need no licence of their own.

The control plane is not in the request path. While it is down, nodes keep inspecting and blocking with their last configuration, and logs queue on each node until it is back. Only three things are affected: configuration cannot be changed, alerts pause, and sites with identity authentication return 502.

Join a node

Enable node access on the control plane

For a new control plane, add --node-url and --node-bind:

sudo sh install.sh --pubkey rstwaf-release.pub --node-url https://10.0.0.5:9444 --node-bind 10.0.0.5

--node-url is the address nodes use to reach the control plane and must match its certificate. On an installed control plane, add the same settings to .env and run docker compose --project-directory /opt/rstwaf up -d. If node access is not enabled, the console's Join node (加入节点) dialog lists the lines to add.

On first start the control plane creates its own CA, server certificate and snapshot signing key in its data volume; no external CA is needed. Ports 9444, 8090, 9445 and 9446 are all bound to the --node-bind address and should be open to the management network only. 8090, 9445 and 9446 are plain HTTP.

Create CrowdSec credentials

On the control plane host, create separate credentials for each node. Nodes must not share them:

sudo /opt/rstwaf/node-creds.sh --name edge2 --lapi-url http://10.0.0.5:8090

The command writes ./node-edge2.env (mode 0600). Copy it securely to the node host.

Create a join token

In the console, go to Sites and nodes (站点与节点) > Nodes (节点) and select Join node. The token is single-use and valid for 1 hour, 24 hours (default) or 7 days. It carries the fingerprint of the control plane CA, which the node uses to verify the control plane certificate, so no certificates need to be distributed beforehand.

Install on the node host

Use the same offline package:

sudo sh install.sh --pubkey rstwaf-release.pub --join 'rstj1_…' --node-env ./node-edge2.env --node-name edge2
rm ./node-edge2.env

The node runs only the data plane and an agent. Once joined, it pulls sites, rules, certificates and rule bundles. The Nodes page shows its online state, version and configuration serial, and any drift: behind, changed locally, or failed to apply.

If a node fails to reload a configuration, it rolls back to the last good snapshot and the console shows the error. Resync (重新同步) makes the node pull and apply the configuration again. After Revoke (吊销), a node receives no further configuration but keeps serving with the last one; then run node-creds.sh --name edge2 --delete on the control plane to withdraw its CrowdSec credentials.

OpenAPI specification files (data/apis/) are not part of configuration snapshots; copy them to each node's data/apis/ where needed. With several nodes, upload certificates rather than using automatic issuance, or every node will request its own.

Active/active data plane

The control plane runs as a single instance, protected by a cold or hot standby; see Upgrade and backup. For data plane high availability, choose one:

  • External load balancer: F5, A10, a cloud SLB, LVS or nginx at layer 4, spreading ports 80 and 443 across the nodes.
  • keepalived: installed by you on the hosts from your distribution's packages; it is not shipped with RST WAF. Use two VRRP instances and two VIPs, each node primary for one VIP, with DNS pointing at both. If a node fails, the other takes over both VIPs.

Health checks

Point the load balancer at GET /.rstwaf/healthz on any site port and expect 200. Check every 2 to 5 seconds, remove a node after 2 consecutive failures and restore it after 2 consecutive successes. The address returns 503 when the node is overloaded or draining before an upgrade, so the load balancer takes it out of rotation.

  • Checks on the HTTP port can omit Host or use an IP address.
  • Checks on the HTTPS port must send the domain of a configured site (SNI), or the TLS handshake fails.
  • Do not use /.rstwaf/livez or an application page as the health check. They still return 200 while a node is draining.
  • Load balancers with passive checks only, such as max_fails in open-source nginx, never see the 503. During upgrades they rely on the data plane finishing in-flight requests for up to 30 seconds before it stops.

If your load balancer can send PROXY protocol, turn it on so the WAF sees real client IPs, and turn on Accept PROXY protocol (接收 PROXY protocol) in the site's advanced settings.

Shared counters

By default, rate limits, the waiting room and account protection count per node, so the effective cluster threshold is roughly the configured value times the number of nodes. Sites with a waiting room need source-IP session persistence on the load balancer.

To count across the cluster, add --shared-store when installing the control plane to use the bundled Valkey:

sudo sh install.sh --pubkey rstwaf-release.pub --node-url https://10.0.0.5:9444 --node-bind 10.0.0.5 --shared-store

The installer writes a random password to .env, and node credential files created by node-creds.sh from then on carry the same RSTWAF_SHARED_STORE. For nodes that have already joined, append the RSTWAF_SHARED_STORE=… line from the control plane's .env unchanged to the node's /opt/rstwaf/.env, then run cd /opt/rstwaf && sudo docker compose up -d rstwaf.

You can also use your own Redis-protocol service (rediss:// for TLS) by pointing RSTWAF_SHARED_STORE on every node at it. --shared-store is then not needed.

  • Give each node a different name, and keep node clocks in sync with NTP.
  • Counting is decided locally and synchronised with the store once a second, so the error is about one second of the other nodes' traffic.
  • If the store is unreachable, nodes fall back to per-node counting and raise a data plane alert (数据面异常), then resume on their own.
  • With a shared store, the waiting room's queue positions and admission slots are shared across the cluster, and the load balancer no longer needs session persistence.

Mirror inspection nodes

A mirror inspection node receives copies of requests and only detects, never blocks. Its events appear in the console as detect only (mirror) (仅检测(旁路)). This lets you assess detection without changing the existing traffic path. Copies can come from nginx mirror, Envoy request_mirror_policies or an Istio VirtualService.mirror, and must be plain HTTP with TLS already terminated.

Mirror inspection needs a Professional or higher licence, or the add-on. Contact support for the deployment procedure.

Host protection

In a multi-node deployment, nodes can also use host firewall bans and SSH brute-force protection. On the control plane host, create the firewall component's credentials with node-creds.sh --name <node> --fw for a new node, or node-creds.sh --name <node> --fw-only --out FILE for a node that has already joined, then append FILE to the node's .env.

On this page