Last active
August 7, 2023 08:14
-
-
Save psujit775/aed0578e1b3d9d813a7d90cc36ed7478 to your computer and use it in GitHub Desktop.
thanos docker compose with s3 storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.3' | |
services: | |
thanos_sidecar: | |
container_name: thanos_sidecar | |
image: quay.io/thanos/thanos:v0.28.0 | |
volumes: | |
- './data/prometheus:/data/prometheus/data' #prometheus data dir | |
command: | |
- 'sidecar' | |
- '--prometheus.url=http://prometheus_ip:port' | |
- '--tsdb.path=/data/prometheus/data' | |
- | | |
--objstore.config=type: S3 | |
config: | |
bucket: thanos-storage | |
access_key: <access_key> | |
secret_key: <secret_key> | |
endpoint: s3.<region-name>.amazonaws.com #replcae the region name. example: s3.ap-south-1.amazonaws.com | |
prefix: prod | |
ports: | |
- 10901:10901 #grpc listener | |
- 10902:10902 #http listener | |
thanos_store: | |
container_name: thanos_store | |
image: quay.io/thanos/thanos:v0.28.0 | |
volumes: | |
- './data/thanos/store:/local/state/data/dir' #persistent storage for thanos store, safe to delete but takes long time to on startup. | |
command: | |
- 'store' | |
- '--data-dir=/local/state/data/dir' | |
- '--grpc-address=0.0.0.0:10901' | |
- '--http-address=0.0.0.0:10902' | |
- | | |
--objstore.config=type: S3 | |
config: | |
bucket: thanos-storage | |
access_key: <access_key> | |
secret_key: <secret_key> | |
endpoint: s3.<region-name>.amazonaws.com #replcae the region name. example: s3.ap-south-1.amazonaws.com | |
prefix: prod | |
ports: | |
- 10903:10902 #http listener | |
- 10904:10901 #grpc listener | |
thanos_querier: | |
container_name: thanos_querier | |
image: quay.io/thanos/thanos:v0.28.0 | |
command: | |
- 'query' | |
- '--http-address=0.0.0.0:9090' | |
- '--store=thanos_store:10904' #thanos_store grpc url, Note: http url can also be used here. | |
- '--store=thanos_sidecar:10901' #thanos_sidecar grpc url | |
- '--query.replica-label=replica' | |
ports: | |
- 10905:9090 | |
thanos_compactor: | |
container_name: thanos_compactor | |
image: quay.io/thanos/thanos:v0.28.0 | |
volumes: | |
- './data/thanos/:/data/thanos' | |
command: | |
- 'compact' | |
- | | |
--objstore.config=type: S3 | |
config: | |
bucket: thanos-storage | |
access_key: <access_key> | |
secret_key: <secret_key> | |
endpoint: s3.<region-name>.amazonaws.com #replcae the region name. example: s3.ap-south-1.amazonaws.com | |
prefix: prod | |
- "--data-dir=/data/thanos" | |
- "--consistency-delay=30m" | |
- "--retention.resolution-raw=14d" #time to keep raw data | |
- "--retention.resolution-5m=90d" #time to keep downsample to 5m data | |
- "--retention.resolution-1h=1y" #time to keep downsample to 1h data | |
- "--compact.concurrency=3" #not more then number of cpu cores | |
- "--delete-delay=15m" | |
- "--wait" | |
- "--wait-interval=3m" | |
ports: | |
- 10906:10902 #http listener | |
- 10907:10901 #grpc listener | |
thanos_query_frontend: | |
container_name: thanos_query_frontend | |
image: quay.io/thanos/thanos:v0.28.0 | |
command: | |
- 'query-frontend' | |
- '--http-address=0.0.0.0:9090' | |
- '--query-frontend.compress-responses' | |
- '--query-range.partial-response' | |
- '--query-frontend.downstream-url=http://thanos_querier:10905' #thanos_querier url | |
- '--query-range.split-interval=24h' | |
- "--query-range.max-retries-per-request=5" | |
- "--query-frontend.log-queries-longer-than=120s" #slow query log | |
- "--cache-compression-type=snappy" | |
ports: | |
- 19090:9090 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment