This page looks best with JavaScript enabled

Installing Thanos from Binaries

 ·  ☕ 1 min read

1. Download the Binaries

1
2
3
4
wget https://github.com/thanos-io/thanos/releases/download/v0.26.0/thanos-0.26.0.linux-amd64.tar.gz
tar xvf thanos-0.26.0.linux-amd64.tar.gz
mv thanos-0.26.0.linux-amd64/thanos /usr/bin/
rm -rf thanos-0.26.0.linux-amd64*

2. Install Thanos Query

1
vim /etc/systemd/system/thanos-query.service
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
[Unit]
Description=Thanos Query
After=network-online.target

[Service]
Restart=on-failure
ExecStart=/usr/bin/thanos query \
    --log.level=debug \
    --query.auto-downsampling \
    --grpc-address=0.0.0.0:30091 \
    --http-address=0.0.0.0:30092 \
    --query.partial-response \
    --query.replica-label=prometheus_replica \
    --query.replica-label=rule_replica  \
    --store=1.0.0.0:30091 \
    --store=2.0.0.0:30091

[Install]
WantedBy=multi-user.target

The --store parameter adds all the sources that need to be aggregated.

1
systemctl daemon-reload && systemctl enable thanos-query
1
systemctl start thanos-query && systemctl status thanos-query

3. Install Thanos Sidecar

1
vim /etc/systemd/system/thanos-sidecar.service
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
[Unit]
Description=Thanos SideCar
After=network-online.target

[Service]
Restart=on-failure
ExecStart=/usr/bin/thanos sidecar \
    --grpc-address=0.0.0.0:30091 \
    --tsdb.path /var/lib/prometheus \
    --prometheus.url "http://localhost:9090"

[Install]
WantedBy=multi-user.target

If you need to upload to object storage, you also need to add --objstore.config-file /etc/thanos/bucket_config.yaml to specify the object storage parameters.

1
systemctl daemon-reload && systemctl enable thanos-sidecar
1
systemctl start thanos-sidecar && systemctl status thanos-sidecar

WeChat Official Account
WRITTEN BY
WeChat Official Account