Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions docs/guides/sharded_ruler.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,50 @@ The only configuration that is required is to enable sharding and configure a ke

Unlike ingesters, rulers do not hand over responsibility: all rules are re-sharded randomly every time a ruler is added to or removed from the ring.

## High availability

Ruler high availability has two independent parts:

- **Evaluation HA** keeps recording rules and alerts evaluating when the ruler responsible for a rule group becomes unavailable.
- **API HA** lets the ruler API serve rule-group state from replicas, including backup copies held by rulers that are not the active evaluator.

Both parts require ruler sharding and a configured ruler ring. The HA features and their configuration are experimental.

### Evaluation HA

Set the ruler ring replication factor to more than `1` and enable HA evaluation:

```yaml
ruler:
enable_sharding: true
enable_ha_evaluation: true
liveness_check_timeout: 1s
ring:
replication_factor: 3
```

The equivalent flags are `-ruler.enable-sharding=true`, `-ruler.ring.replication-factor=3`, and `-ruler.enable-ha-evaluation=true`.

With replication enabled, replicas receive backup copies of rule groups. The active replica evaluates a group while the other replicas keep its backup. If the active ruler fails or becomes unreachable, another replica can take over evaluation. Non-primary rulers use the liveness check and `-ruler.liveness-check-timeout` (default `1s`) before evaluating the group; increase the timeout if normal ring or network latency causes unnecessary failover, and keep it small enough that an unavailable primary is detected promptly.

Run at least three replicas when using `replication_factor: 3`, and spread them across failure domains. If zone awareness is available, set `-ruler.ring.zone-awareness-enabled=true` and configure the ruler instances with their availability zones. The replication factor also sets the minimum per-tenant shard size.

### API HA

Enable the ruler API and use the same ring replication factor:

```yaml
ruler:
enable_api: true
ring:
replication_factor: 3
zone_awareness_enabled: true
```

The equivalent flags are `-ruler.enable-api=true`, `-ruler.ring.replication-factor=3`, and, when zones are configured, `-ruler.ring.zone-awareness-enabled=true`. API requests can then use the replicated rule-group state instead of depending on a single ruler. During propagation or failover, replicas can briefly report different evaluation state. If duplicate rules in the Prometheus rules and alerts responses are a problem, the experimental `-experimental.ruler.api-deduplicate-rules=true` option keeps the rule with the latest evaluation timestamp.

See the [configuration reference](../configuration/config-file-reference.md#ruler_config) for all ruler ring, tenant-sharding, and storage options.

## Ruler Storage

The ruler supports six kinds of storage (configdb, Azure, GCS, S3, Swift, local). Most kinds of storage work with the sharded ruler configuration in an obvious way, i.e. configure all rulers to use the same backend.
Expand Down