Skip to content

Commit

Permalink
Add sharding example to operator docs (grafana#4642)
Browse files Browse the repository at this point in the history
Signed-off-by: Paschalis Tsilias <[email protected]>
Co-authored-by: Paschalis Tsilias <[email protected]>
Co-authored-by: Clayton Cornell <[email protected]>
Co-authored-by: Paschalis Tsilias <[email protected]>
  • Loading branch information
4 people authored and BarunKGP committed Feb 20, 2024
1 parent db458f5 commit 3205749
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions docs/sources/operator/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,69 @@ Two labels are added by default to every metric:

The shard number is not added as a label, as sharding is designed to be
transparent on the receiver end.

## Enable sharding and replication

To enable sharding and replication, you must set the `shards` and `replicas` properties in the Grafana Agent configuration file. For example, the following configuration file would shard the data into three shards and replicate each shard to two other Grafana Agent instances:

```
shards: 3
replicas: 2
```

You can also enable sharding and replication by setting the `shards` and `replicas` arguments when you start the Grafana Agent.

### Examples

The following examples show you how to enable sharding and replication in a Kubernetes environment.

* To shard the data into three shards and replicate each shard to two other Grafana Agent instances, you would use the following deployment manifest:

```
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana-agent
spec:
replicas: 3
selector:
matchLabels:
app: grafana-agent
template:
metadata:
labels:
app: grafana-agent
spec:
containers:
- name: grafana-agent
image: grafana/agent:latest
args:
- "--shards=3"
- "--replicas=2"
```
* To shard the data into 10 shards and replicate each shard to three other Grafana Agent instances, you would use the following deployment manifest:
```
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana-agent
spec:
replicas: 10
selector:
matchLabels:
app: grafana-agent
template:
metadata:
labels:
app: grafana-agent
spec:
containers:
- name: grafana-agent
image: grafana/agent:latest
args:
- "--shards=10"
- "--replicas=3"
```

0 comments on commit 3205749

Please sign in to comment.