安装thanos
下载:
https://github.com/thanos-io/thanos/releases/download/v0.22.0/thanos-0.22.0.linux-amd64.tar.gz
解压:
tar -xf thanos-0.22.0.linux-amd64.tar.gz -C /usr/local/
thanos 使用腾讯云cos
在主目录下创建一个yml的文件,配置对象存储的配置
type: COS
config:
bucket: "thanos"
region: "ap-nanjing"
app_id: "1305787793"
secret_key: "1nKfnlY7SZT8ZliSxGLBm8F6i5D8rVyC"
secret_id: "AKIDxlMkyzlIbfU4QYQ3RaVFl24yf7PSGqER"
http_config:
idle_conn_timeout: 1m30s
response_header_timeout: 2m
tls_handshake_timeout: 10s
expect_continue_timeout: 1s
max_idle_conns: 100
max_idle_conns_per_host: 100
max_conns_per_host: 0
thanos 使用阿里云oos
type: ALIYUNOSS
config:
endpoint: ""
bucket: ""
access_key_id: ""
access_key_secret: ""
sidecar
./thanos sidecar --prometheus.url=http://127.0.0.1:9090 --tsdb.path=/prometheus-data --http-address 0.0.0.0:19191 --grpc-address 0.0.0.0:19090 --shipper.upload-compacted --objstore.config-file bucket.yml
store gateway
nohup /usr/local/thanos/thanos store --data-dir /prometheus-data --objstore.config-file /usr/local/thanos/backet.yml --http-address 0.0.0.0:39191 --grpc-address 0.0.0.0:39090 > /usr/local/thanos/log/store.log 2>&1 &
—data-dir 数据目录 —objstore.config-file bucket配置 —http-address 监听地址与端口 —grpc-address api 访问地址与端口 —store 是sidecar和store的地址和端口
query
nohup /usr/local/thanos/thanos query --http-address 0.0.0.0:19192 --store 10.111.22.16:19090 --store 10.111.22.17:19090 --store "10.111.22.18:39090" --store "10.111.22.20:39090" > /usr/local/thanos/log/query.log 2>&1 &
—store指定所有sidecar的访问地址和store的地址
以上几个组件均可分布式部署提高高可用
prometheus+sidecar 、store、query 可以按这几类区分
接下来就可以使用: curl $http-address:port 访问thanos页面