Skip to content

Instantly share code, notes, and snippets.

@blockloop
Last active April 23, 2022 02:41
Show Gist options
  • Save blockloop/637bd0c8c9295178b67812f43e661419 to your computer and use it in GitHub Desktop.
Save blockloop/637bd0c8c9295178b67812f43e661419 to your computer and use it in GitHub Desktop.
Thanos Receive example with docker-compose
version: "3"
networks:
default:
driver: bridge
ipam:
config:
- subnet: 172.16.57.0/24
services:
prometheus:
image: prom/prometheus:v2.15.2
ports:
- 9090:9090
volumes:
- ${PWD}/prometheus.yaml:/prometheus.yaml
command:
- '--config.file=/prometheus.yaml'
query:
image: quay.io/blockloop/thanos@sha256:f6dfe89483ed9f8d9d256d5da9928bcfbd7c41dfd73e9c4ce140b0b01ccf24a8
ports:
- 10902:10902
command: >
query
--log.format=logfmt
--query.replica-label=replica
--store=thanos-01:10901
--store=thanos-02:10901
--store=thanos-03:10901
thanos-01:
image: quay.io/blockloop/thanos@sha256:f6dfe89483ed9f8d9d256d5da9928bcfbd7c41dfd73e9c4ce140b0b01ccf24a8
ports:
- 10902
- 10901
- 19291
volumes:
- ${PWD}/hashring.json:/hashring.json
- ${PWD}/data-01:/data
command: >
receive
--log.level=debug
--log.format=logfmt
--remote-write.address=0.0.0.0:19291
--tsdb.retention=24h
--tsdb.path=/data
--tsdb.min-block-duration=2h
--tsdb.max-block-duration=32h
--receive.replication-factor=2
--receive.hashrings-file=/hashring.json
--label=replica='"thanos-01"'
--receive.local-endpoint="thanos-01:10901"
thanos-02:
image: quay.io/blockloop/thanos@sha256:f6dfe89483ed9f8d9d256d5da9928bcfbd7c41dfd73e9c4ce140b0b01ccf24a8
ports:
- 10902
- 10901
- 19291
volumes:
- ${PWD}/hashring.json:/hashring.json
- ${PWD}/data-02:/data
command: >
receive
--log.level=debug
--log.format=logfmt
--remote-write.address=0.0.0.0:19291
--tsdb.path=/data
--tsdb.retention=24h
--tsdb.min-block-duration=2h
--tsdb.max-block-duration=32h
--receive.replication-factor=2
--receive.hashrings-file=/hashring.json
--label=replica='"thanos-02"'
--receive.local-endpoint="thanos-02:10901"
thanos-03:
image: quay.io/blockloop/thanos@sha256:f6dfe89483ed9f8d9d256d5da9928bcfbd7c41dfd73e9c4ce140b0b01ccf24a8
ports:
- 10902
- 10901
- 19291
volumes:
- ${PWD}/hashring.json:/hashring.json
- ${PWD}/data-03:/data
command: >
receive
--log.level=debug
--log.format=logfmt
--remote-write.address=0.0.0.0:19291
--tsdb.path=/data
--tsdb.retention=24h
--tsdb.min-block-duration=2h
--tsdb.max-block-duration=32h
--receive.replication-factor=2
--receive.hashrings-file=/hashring.json
--label=replica='"thanos-03"'
--receive.local-endpoint="thanos-03:10901"
[
{
"hashring": "default",
"endpoints": ["thanos-01:10901", "thanos-02:10901", "thanos-03:10901"],
"tenants": []
}
]
# vim set syntax=yaml
global:
scrape_interval: 10s
evaluation_interval: 60s
remote_write:
- url: "http://thanos-01:19291/api/v1/receive"
queue_config:
max_samples_per_send: 500
batch_send_deadline: 5s
min_backoff: 50ms
max_backoff: 500ms
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['127.0.0.1:9090']
- job_name: 'thanos'
static_configs:
- targets: ['thanos-01:10902', 'thanos-02:10902', 'thanos-03:10902']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment