3.8 프로메테우스 단점을 극복한 타노스
2 min readJan 11, 2023
프로메테우스는 단점이 있습니다.
- 오브젝트 스토리지를 지원하지 않습니다.
- 클러스터링 구성을 지원하지 않습니다. 프로메테우스는 부분적으로 샤딩과 고가용성은 지원합니다.
복잡한 쿠버네티스 환경보다는 우분투 환경을 사용합니다. 테스트를 진행하기 위해서는 프로메테우스, 미니오, 타노스가 필요합니다.
타노스를 다운받습니다.
wget https://github.com/thanos-io/thanos/releases/download/v0.25.0/thanos-0.25.0.linux-amd64.tar.gz
/etc/prometheus/prometheus.yml 입니다. replica: prometheus-1을 추가합니다.
global:
scrape_interval: 5s
evaluation_interval: 15s
external_labels:
cluster: eu1
replica: prometheus-1
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
- job_name: 'sidecar'
static_configs:
- targets: ['localhost:10902']
프로메테우스 구성파일입니다.
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /etc/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries \
--storage.tsdb.max-block-duration=2h \
--storage.tsdb.min-block-duration=2h \
--web.enable-lifecycle \
--web.enable-admin-api \
--log.level=info
[Install]
WantedBy=multi-user.target
테스트 목적으로 1m 으로 변경합니다.
/etc/prometheus/bucket.yml 의 구성파일은 아래와 같습니다. 미니오에는 bucket 이라는 버킷을 생성하고, 아래처럼 액세스키를 생성합니다.
type: S3
config:
bucket: bucket
access_key: admin
secret_key: password
endpoint: localhost:9000
insecure: true
타노스 사이드카 구성파일입니다.
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/bin/thanos sidecar \
--prometheus.url=http://localhost:9090 \
--grpc-address=localhost:10901 \
--http-address=localhost:10902 \
--tsdb.path /var/lib/prometheus/ \
--objstore.config-file /etc/prometheus/bucket.yml
[Install]
WantedBy=multi-user.target
타노스 사이드카를 시작합니다.
sudo systemctl start sidecar
타노스 스토어 구성파일입니다.
[Unit]
Description=Thnaos Store
Wants=network-online.target
After=network-online.target
[Service]
User=root
Group=root
Type=simple
ExecStart=/bin/thanos store \
--data-dir=/var/lib/prometheus-store/ \
--objstore.config-file=/etc/prometheus/bucket.yml \
--http-address=localhost:10906 \
--grpc-address=localhost:10905
[Install]
WantedBy=multi-user.target
타노스 스토어를 시작합니다.
sudo systemctl start store
타노스 쿼리 구성파일입니다. query.replica-label prometheus-1를 사용합니다.
[Unit]
Description=Thnaos Query
Wants=network-online.target
After=network-online.target
[Service]
User=root
Group=root
Type=simple
ExecStart=/bin/thanos query \
--http-address=0.0.0.0:29090 \
--grpc-address=localhost:10903 \
--store=localhost:10901 \
--query.replica-label prometheus-1
[Install]
WantedBy=multi-user.target
타노스 쿼리를 시작합니다.
sudo systemctl start query
스토어에 접속합니다.
먼저 쓰기 경로를 검증합니다.
1분마다 오브젝트 스토리지에 적재를 합니다.
읽기는 타노스 쿼리어 화면에서 검증하실 수 있습니다.