自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Thanos監(jiān)控系統(tǒng)實(shí)戰(zhàn)部署

安全 應(yīng)用安全
在本文中,我們詳細(xì)探討了Thanos監(jiān)控系統(tǒng)的部署過程,包括系統(tǒng)架構(gòu)介紹、各個(gè)組件的配置和完整的部署案例。Thanos為Prometheus提供了強(qiáng)大的監(jiān)控解決方案,具備全局查詢、高可用性、動(dòng)態(tài)擴(kuò)展和長期存儲(chǔ)等特性。

Thanos 是一個(gè)基于 Prometheus 實(shí)現(xiàn)的監(jiān)控方案,其主要設(shè)計(jì)目的是解決原生 Prometheus 上的痛點(diǎn),并且做進(jìn)一步的提升,主要的特性有:全局查詢,高可用,動(dòng)態(tài)拓展,長期存儲(chǔ)。

下圖是 Thanos 官方的架構(gòu)圖:

圖片圖片

Thanos組件

Thanos是一組組件,可以組合成一個(gè)具有無限存儲(chǔ)容量的高可用指標(biāo)系統(tǒng),Thanos 主要由如下幾個(gè)特定功能的組件組成:

  • 邊車組件(Sidecar):連接 Prometheus,并把 Prometheus 暴露給查詢網(wǎng)關(guān)(Querier/Query),以供實(shí)時(shí)查詢,并且可以上傳 Prometheus 數(shù)據(jù)給云存儲(chǔ),以供長期保存
  • 查詢網(wǎng)關(guān)(Querier/Query):實(shí)現(xiàn)了 Prometheus API,與匯集底層組件(如邊車組件 Sidecar,或是存儲(chǔ)網(wǎng)關(guān) Store Gateway)的數(shù)據(jù)
  • 存儲(chǔ)網(wǎng)關(guān)(Store Gateway):將云存儲(chǔ)中的數(shù)據(jù)內(nèi)容暴露出來
  • 壓縮器(Compactor):將云存儲(chǔ)中的數(shù)據(jù)進(jìn)行壓縮和下采樣
  • 接收器(Receiver):從 Prometheus 的 remote-write WAL(Prometheus 遠(yuǎn)程預(yù)寫式日志)獲取數(shù)據(jù),暴露出去或者上傳到云存儲(chǔ)
  • 規(guī)則組件(Ruler):針對(duì)監(jiān)控?cái)?shù)據(jù)進(jìn)行評(píng)估和報(bào)警
  • Bucket:主要用于展示對(duì)象存儲(chǔ)中歷史數(shù)據(jù)的存儲(chǔ)情況,查看每個(gè)指標(biāo)源中數(shù)據(jù)塊的壓縮級(jí)別,解析度,存儲(chǔ)時(shí)段和時(shí)間長度等信息。

讀取指標(biāo)的流程

  • 首先客戶端通過 query API 向 query 發(fā)起查詢,query 將請(qǐng)求轉(zhuǎn)換成 StoreAPI 發(fā)送到其他的 query、sidecar、rule 和 store 上。
  • sidecar 接收到來自于 query 發(fā)起的查詢請(qǐng)求后將其轉(zhuǎn)換成 query API 請(qǐng)求,發(fā)送給其綁定的 Prometheus,由Prometheus 從本地讀取數(shù)據(jù)并響應(yīng),返回短期的本地采集和評(píng)估數(shù)據(jù)。
  • rule 接收到來自于 query 發(fā)起的查詢請(qǐng)求后直接從本地讀取數(shù)據(jù)并響應(yīng),返回短期的本地評(píng)估數(shù)據(jù)。
  • store 接收到來自于 query 發(fā)起的查詢請(qǐng)求后首先從對(duì)象存儲(chǔ)桶中遍歷數(shù)據(jù)塊的 meta.json,根據(jù)其中記錄的時(shí)間范圍和標(biāo)簽先進(jìn)行一次過濾。接下來從對(duì)象存儲(chǔ)桶中讀取數(shù)據(jù)塊的 index 和 chunks 進(jìn)行查詢,部分查詢頻率較高的index 會(huì)被緩存下來,下次查詢使用到時(shí)可以直接讀取。最終返回長期的歷史采集和評(píng)估指標(biāo)。

對(duì)于發(fā)送報(bào)警的流程如下所示:

  • Prometheus 根據(jù)自身配置的 alerting 規(guī)則定期地對(duì)自身采集的指標(biāo)進(jìn)行評(píng)估,當(dāng)告警條件滿足的情況下發(fā)起告警到 Alertmanager 上。
  • rule 根據(jù)自身配置的 alerting 規(guī)則定期的向 query 發(fā)起查詢請(qǐng)求獲取評(píng)估所需的指標(biāo),當(dāng)告警條件滿足的情況下發(fā)起告警到 Alertmanager 上。
  • Alertmanager 接收到來自于 Prometheus 和 rule 的告警消息后進(jìn)行分組合并后發(fā)出告警通知。

特性(優(yōu)勢)

Thanos 相比起原生的 Prometheus 具有以下的一些優(yōu)勢:

  • 統(tǒng)一查詢?nèi)肟凇?Query 作為統(tǒng)一的查詢?nèi)肟冢渥陨韺?shí)現(xiàn)了 Prometheus 的查詢接口和StoreAPI,可為其他的 Query 提供查詢服務(wù),在查詢時(shí)會(huì)從每個(gè) Prometheus 實(shí)例的 Sidecar 和 Store Gateway 獲取到指標(biāo)數(shù)據(jù)。
  • 查詢?nèi)ブ亍總€(gè)數(shù)據(jù)塊都會(huì)帶有特定的集群標(biāo)簽, Query 在做查詢時(shí)會(huì)去除集群標(biāo)簽,將指標(biāo)名稱和標(biāo)簽一致的序列根據(jù)時(shí)間排序合并。雖然指標(biāo)數(shù)據(jù)來自不同的采集源,但是只會(huì)響應(yīng)一份結(jié)果而不是多份重復(fù)的結(jié)果。
  • 高空間利用率——每個(gè) Prometheus 本身不存儲(chǔ)長時(shí)間的數(shù)據(jù),Sidecar 會(huì)將 Prometheus 已經(jīng)持久化的數(shù)據(jù)塊上傳到對(duì)象存儲(chǔ)中。Compactor 會(huì)定時(shí)將遠(yuǎn)端對(duì)象存儲(chǔ)中的長期數(shù)據(jù)進(jìn)行壓縮,并且根據(jù)采樣時(shí)長做清理,節(jié)約存儲(chǔ)空間。
  • 高可用——Query 是無狀態(tài)服務(wù),天生支持水平拓展和高可用。Store、Rule 和 Sidecar 是有狀態(tài)服務(wù),在多副本部署的情況下也支持高可用,不過會(huì)產(chǎn)生數(shù)據(jù)冗余,需要犧牲存儲(chǔ)空間。
  • 存儲(chǔ)長期數(shù)據(jù)——Prometheus 實(shí)例的 Sidecar 會(huì)將本地?cái)?shù)據(jù)上傳到遠(yuǎn)端對(duì)象存儲(chǔ)中作為長期數(shù)據(jù)
  • 橫向拓展——當(dāng) Prometheus 的指標(biāo)采集壓力過大時(shí),可以創(chuàng)建新的 Prometheus 實(shí)例,將scrape job 拆分給多個(gè) Prometheus,Querier 從多個(gè) Prometheus 查詢匯聚結(jié)果,降低單個(gè) Prometheus 的壓力
  • 跨集群查詢——需要合并多個(gè)集群的查詢結(jié)果時(shí),僅需要在每個(gè)集群的 Querier 之上再添加一層 Querier 即可,這樣的層層嵌套,可以使得集群規(guī)模無限制拓展。

對(duì)象存儲(chǔ)

一般來說, 我們將存儲(chǔ)分為文件存儲(chǔ), 塊存儲(chǔ)和對(duì)象存儲(chǔ).

  • 文件存儲(chǔ): 一般都是POSIX協(xié)議的,比如我們的操作系統(tǒng)上的XFS,EXT4
  • 塊存儲(chǔ): 一般都是有虛擬化層實(shí)現(xiàn)的,有可能是kernel自帶的模塊,如AWS的EBS
  • 對(duì)象存儲(chǔ): 對(duì)象存儲(chǔ)通常向外提供API接口,系統(tǒng)通過網(wǎng)絡(luò)向?qū)ο蟠鎯?chǔ)的接口傳輸數(shù)據(jù).公有云的代表,AWS的s3,私有云的就是MinIO,案例中我也將用MinIO來作為存儲(chǔ).

部署案例

在了解了Thanos的架構(gòu)和組件服務(wù)之后,下面將進(jìn)行實(shí)戰(zhàn)配置安裝。準(zhǔn)備4臺(tái)虛擬機(jī),配置如下:

圖片

部署Promethues

node3, node4 執(zhí)行
useradd -s /sbin/nologin prometheus
mkdir -p /app/src
cd /app/src
wget https://github.com/prometheus/prometheus/releases/download/v2.36.1/prometheus-2.36.1.linux-amd64.tar.gz
tar -xvf prometheus-2.36.1.linux-amd64.tar.gz 
cd prometheus-2.36.1.linux-amd64
mv prometheus promtool /usr/local/sbin 
mkdir /var/lib/prometheus
mv consoles console_libraries /var/lib/prometheus/
mkdir /etc/prometheus 
mv prometheus.yml /etc/prometheus/
chown -R prometheus:prometheus /usr/local/sbin/prometheus /usr/local/sbin/promtool /etc/prometheus/ /app/prometheus/ /var/lib/prometheus

修改配置文件

vim /etc/prometheus/prometheus.yml 
# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).
  external_labels:
    replica: A


# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093


# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"


# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"


    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.


    static_configs:
      - targets: ["localhost:9090"]


  - job_name: "node_exporter"
    static_configs:
      - targets: ["192.168.100.30:9100","192.168.100.40:9100","192.168.100.50:9100","192.168.100.60:9100"]

system文件

vim /etc/systemd/system/prometheus.service
[Unit]
Descriptinotallow=prometheus
Documentatinotallow=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=prometheus
ExecStartPre=/usr/local/sbin/promtool check config /etc/prometheus/prometheus.yml
ExecStart=/usr/local/sbin/prometheus \
          --config.file=/etc/prometheus/prometheus.yml \
          --web.listen-address=0.0.0.0:9090 \
          --web.enable-lifecycle \
          --web.enable-admin-api \
          --web.console.templates=/var/lib/prometheus/console \
          --web.console.libraries=/var/lib/prometheus/console_libraries \
          --storage.tsdb.path=/app/prometheus/ \
          --storage.tsdb.min-block-duratinotallow=5m \
          --storage.tsdb.max-block-duratinotallow=5m \
          --storage.tsdb.retention.time=30d \
          --log.level=info
ExecReload=/bin/curl -X POST http://127.0.0.1:9090/-/reload
TimeoutStopSec=20s
Restart=always
LimitNOFILE=20480000
[Install]
WantedBy=multi-user.target

--storage.tsdb.min-block-duratinotallow=5m--storage.tsdb.max-block-duratinotallow=5m 默認(rèn)為2h, 修改為5分鐘, sidecar向store寫入數(shù)據(jù),方便查看效果.

Node_exporter 安裝

node1, node2, node3, node4 執(zhí)行
cd /app/src
wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz
tar -xvf node_exporter-1.3.1.linux-amd64.tar.gz
cd node_exporter-1.3.1.linux-amd64
mv node_exporter /usr/local/sbin/

創(chuàng)建system文件

 vim /usr/lib/systemd/system/node_exporter.service

[Unit]
Descriptinotallow=node_exporter
Documentatinotallow=https://prometheus.io/
After=network.target


[Service]
Type=simple
ExecStart=/usr/local/sbin/node_exporter \
          --collector.systemd 
ExecReload=/bin/kill -HUP 
TimeoutStopSec=20s
Restart=always


[Install]
WantedBy=multi-user.target

部署 Thanos

Thanos 只需要兩個(gè)組件就可以簡單形成一個(gè)集群,query和sidecar用來抽象數(shù)據(jù)層,query 來查詢抽象出來的數(shù)據(jù)層,提供查詢的接口,

根據(jù)Thanos架構(gòu)圖,不考慮高可用的情況下除了sidecar組件外,query,store,Compactor組件只需部署一份

node1, node3,node4 ,執(zhí)行
cd /app/src/
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
cd thanos-0.26.0.linux-amd64
mv thanos /usr/local/sbin


mkdir /app/thanos
mkdir /app/thanos/compact
mkdir /app/thanos/store
mkdir /app/thanos/ruler


mkdir /etc/thanos

Thanos sidecar

node3,node4執(zhí)行

  • systemd 文件

# vim /etc/systemd/system/thanos-sidecar.service
[Unit]
Descriptinotallow=thanos-sidecar
Documentatinotallow=https://thanos.io/
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/sbin/thanos sidecar \
          --tsdb.path=/app/prometheus \
          --prometheus.url=http://localhost:9090 \
          --http-address=0.0.0.0:10901 \
          --grpc-address=0.0.0.0:10902
ExecReload=/bin/kill -HUP 
TimeoutStopSec=20s
Restart=always
[Install]
WantedBy=multi-user.target

Thanos query

node1執(zhí)行

  • systemd文件
# vim /etc/systemd/system/thanos-query.service
[Unit]
Descriptinotallow=thanos-query
Documentatinotallow=https://thanos.io/
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/sbin/thanos query \
          --http-address=0.0.0.0:10903 \
          --grpc-address=0.0.0.0:10904 \
          --store=192.168.100.50:10902 \
          --store=192.168.100.60:10902 \
          --query.timeout=10m \
          --query.max-cnotallow=200 \
          --query.max-concurrent-select=40 \
          --query.replica-label=replica
ExecReload=/bin/kill -HUP 
TimeoutStopSec=20s
Restart=always
LimitNOFILE=20480000
[Install]
WantedBy=multi-user.targe

部署MinIO

node1,node2,node3,node4執(zhí)行

Minio存儲(chǔ)架構(gòu)

  • 單主機(jī),單硬盤模式: Minio只在一臺(tái)服務(wù)器上搭建服務(wù),且數(shù)據(jù)都存在單塊磁盤上,該模式存在單點(diǎn)風(fēng)險(xiǎn)
  • 單主機(jī),多硬盤模式:  Minio在一臺(tái)服務(wù)器上搭建服務(wù),但數(shù)據(jù)分散在多塊(大于4塊)磁盤上,提供了數(shù)據(jù)上的安全保障 (類似于容器模式)
  • 多主機(jī),多硬盤模式(分布式): 該模式是Minio服務(wù)最常用的架構(gòu),通過共享一個(gè)access_key和secret_key,在多臺(tái)(2-32)服務(wù)器上搭建服務(wù),且數(shù)據(jù)分散在多塊(大于4塊,無上限)磁盤上,提供了較為強(qiáng)大的數(shù)據(jù)冗余機(jī)制

準(zhǔn)備工作

這里我們采用分布式存儲(chǔ),在四臺(tái)服務(wù)器上進(jìn)行安裝.

注意: data目錄不可以和root目錄在同一磁盤,需要另外添加磁盤。錯(cuò)誤信息 :ispart of root disk, will not be used (*errors.errorString)

wget http://dl.minio.org.cn/server/minio/release/linux-amd64/minio
mv minio /usr/local/sbin
chmod +x /usr/local/sbin/minio
mkdir -p /app/minio/data 
mkdir /etc/minio 
mkdir /app/minio/run

MinIO配置文件

  • 用戶信息 vim /etc/minio/minio.pw

MINIO_ROOT_USER=root
MINIO_ROOT_PASSWORD=Password

這里指定了4臺(tái)minio的地址,通過統(tǒng)一的minio.pw和啟動(dòng)文件,可以讓4臺(tái)minio做到數(shù)據(jù)互通。minio會(huì)依次啟動(dòng),順序?yàn)閰?shù)的先后順序

  • systemd文件vim /etc/systemd/system/minio.service

[Unit]
Descriptinotallow=Minio service
Documentatinotallow=https://docs.minio.io/


[Service]
WorkingDirectory=/app/minio/run/
Envirnotallow=/etc/minio/minio.pw
ExecStart=/usr/local/sbin/minio server \
          --config-dir /etc/minio \
          --address :9000 \
          --console-address :9001 \
          http://192.168.100.30:9000/app/minio/data \
          http://192.168.100.40:9000/app/minio/data \
          http://192.168.100.50:9000/app/minio/data \
          http://192.168.100.60:9000/app/minio/data
Restart=on-failure
RestartSec=5
LimitNOFILE=20480000
[Install]
WantedBy=multi-user.target

負(fù)載均衡

在node1 配置nginx vim /etc/nginx/conf.d/minio.conf

server {
        listen 9900;
        server_name  192.168.100.30;


location / {
        proxy_pass http://minio;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        }
}


upstream minio {
        server 192.168.100.30:9000;
        server 192.168.100.40:9000;
        server 192.168.100.50:9000;
        server 192.168.100.60:9000;
}

Thanos Store

node1執(zhí)行
mkdir -p /app/thanos/store

  • systemd文件vim /etc/systemd/system/thanos-store.service

[Unit]
Descriptinotallow=thanos-store
Documentatinotallow=https://thanos.io/
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/sbin/thanos store \
          --data-dir=/app/thanos/store \
          --objstore.config-file=/etc/thanos/thanos-minio.yml \
          --http-address=0.0.0.0:10905 \
          --grpc-address=0.0.0.0:10906 \
          --chunk-pool-size=8GB \
          --max-time=30d
ExecReload=/bin/kill -HUP 
TimeoutStopSec=20s
Restart=always
LimitNOFILE=20480000
[Install]
WantedBy=multi-user.targe

  • 配置對(duì)象存儲(chǔ)配置文件vim /etc/thanos/thanos-minio.yml

type: S3
config:
  bucket: "thanos"
  endpoint: "192.168.100.30:9000"
  access_key: "root"
  secret_key: "Password"
  insecure: true
  signature_version2: false
  http_config:
    idle_conn_timeout: 5m
    response_header_timeout: 10m
    insecure_skip_verify: true
systemctl start thanos-store

在 node3, node4 ,sidecar的system文件添加

--objstore.config-file=/etc/thanos/thanos-minio.yml \


# cat /etc/systemd/system/thanos-sidecar.service
[Unit]
Descriptinotallow=thanos-sidecar
Documentatinotallow=https://thanos.io/
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/sbin/thanos sidecar \
          --tsdb.path=/app/prometheus \
          --prometheus.url=http://localhost:9090 \
          --objstore.config-file=/etc/thanos/thanos-minio.yml \
          --http-address=0.0.0.0:10901 \
          --grpc-address=0.0.0.0:10902 
ExecReload=/bin/kill -HUP 
TimeoutStopSec=20s
Restart=always
[Install]
WantedBy=multi-user.target

在 node1  query 的system文件添加store的grpc地址

--store=192.168.100.30:10906 \


[root@node1 ~]# cat /etc/systemd/system/thanos-query.service
[Unit]
Descriptinotallow=thanos-query
Documentatinotallow=https://thanos.io/
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/sbin/thanos query \
          --http-address=0.0.0.0:10903 \
          --grpc-address=0.0.0.0:10904 \
          --query.timeout=10m \
          --query.max-cnotallow=200 \
          --query.max-concurrent-select=40 \
          --store=192.168.100.30:10906 \
          --query.replica-label=replica
ExecReload=/bin/kill -HUP 
TimeoutStopSec=20s
Restart=always
LimitNOFILE=20480000
[Install]
WantedBy=multi-user.targe

為了展示對(duì)象存儲(chǔ)的效果,我們把node3和node4,  sidecar的地址刪除,只查詢store的地址,這樣我們就可以在grafana看到下圖, 可以看到提供的信息并不是實(shí)時(shí)的,而是store寫入對(duì)象存儲(chǔ)的數(shù)據(jù), 這只是為了測試store的可用性,實(shí)際環(huán)境中,數(shù)據(jù)的寫入默認(rèn)為2h一次,不符合監(jiān)控實(shí)時(shí)性的要求.

圖片

Thanos compact

node1執(zhí)行:

compact的作用是定期把歷史數(shù)據(jù)存入對(duì)象存儲(chǔ),其實(shí)他就像是一個(gè)cronjob, 如果發(fā)現(xiàn)滿足了條件,就會(huì)對(duì)對(duì)象存儲(chǔ)中的數(shù)據(jù)進(jìn)行整理

  • 初始化

mkdir /app/thanos/compact

  • systemd文件vim /etc/systemd/system/thanos-compact.service

[Unit]
Descriptinotallow=Thanos-compact
Documentatinotallow=https://thanos.io/
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/sbin/thanos compact \
          --data-dir=/app/thanos/compact \
          --objstore.config-file=/etc/thanos/thanos-minio.yml \
          --http-address=0.0.0.0:10923 \
          --wait-interval=5m \
          --block-sync-cnotallow=30 \
          --compact.cnotallow=6
ExecReload=/bin/kill -HUP 
TimeoutStopSec=20s
Restart=on-failure
[Install]
WantedBy=multi-user.target

Prometheus自動(dòng)注冊

部署Consul 

  • node2

    創(chuàng)建配置文件 vim /etc/consul/server.json

{
"data_dir": "/app/consul/data",
"log_file": "/app/consul/log/consul.log",
"log_level": "INFO",
"log_rotate_duration": "24h",
"node_name": "node2",
"server": true,
"bootstrap_expect": 1,
"client_addr": "0.0.0.0",
"advertise_addr": "192.168.100.40",
"acl": {
    "enabled": true,
    "default_policy": "deny",
    "down_policy": "extend-cache",
    "enable_token_persistence": true,
    "tokens":{
      "master": "727d2766-ac98-26c5-0f30-47b4f6a5632d"
  }
}

創(chuàng)建守護(hù)進(jìn)程 vim /etc/systemd/system/consul-server.service

[Unit]
Descriptinotallow=Consul service
Documentatinotallow=https://www.consul.io/docs/


[Service]
ExecStart=/usr/local/bin/consul agent -ui -config-dir /etc/consul
KillSignal=SIGINT
Restart=on-failure
RestartSec=5


[Install]
WantedBy=multi-user.target

啟動(dòng)consul并測試

systemctl start consul-server

瀏覽器訪問 8500端口,提示需要登錄

圖片

使用 consul acl bootstrap 記錄SecretID 作為token

[root@node2 ~]# consul acl bootstrap
AccessorID:       6036d229-b123-5a0f-ef9f-df2b7efcd410
SecretID:         727d2766-ac98-26c5-0f30-47b4f6a5632d
Description:      Bootstrap Token (Global Management)
Local:            false
Create Time:      2022-09-19 05:21:26.374769398 +0800 CST
Policies:
   00000000-0000-0000-0000-000000000001 - global-management

把token添加到配置文件

vim /etc/consul/server.json

{
"data_dir": "/app/consul/data",
"log_file": "/app/consul/log/consul.log",
"log_level": "INFO",
"log_rotate_duration": "24h",
"node_name": "node2",
"server": true,
"bootstrap_expect": 1,
"client_addr": "0.0.0.0",
"advertise_addr": "192.168.100.40",
"acl": {
    "enabled": true,
    "default_policy": "deny",
    "down_policy": "extend-cache",
    "enable_token_persistence": true,
    "tokens":{
      "master": "727d2766-ac98-26c5-0f30-47b4f6a5632d"
  }
 }
}

重啟consul

github 地址: https://github.com/starsliao/ConsulManager

準(zhǔn)備工作

添加鏡像倉庫

yum-``config``-manager--add-repo**https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

使用docker-compose來部署ConsulManager

  • 下載:wget https://starsl.cn/static/img/docker-compose.yml(倉庫根目錄下docker-compose.yml)
  • 編輯:docker-compose.yml,修改3個(gè)環(huán)境變量:

consul_token:consul的登錄token(上文獲取的,SecretID)

consul_url:consul的URL(http開頭,/v1要保留)

admin_passwd:登錄ConsulManager Web的admin密碼

  • 啟動(dòng):docker-compose pull && docker-compose up -d

  • 訪問:http://{IP}:1026,使用配置的ConsulManager admin密碼登錄

添加主機(jī)監(jiān)控

安裝完成后,在平臺(tái)新增監(jiān)控主機(jī)的信息

圖片圖片

添加完成后,查看consul;

圖片圖片

配置prometheus讀取consul信息;

圖片圖片

將之前配置好的內(nèi)容刪除,添加生成的配置信息;

圖片圖片

查看query, grafana,顯示注冊完成;

圖片圖片

圖片圖片

在本文中,我們詳細(xì)探討了Thanos監(jiān)控系統(tǒng)的部署過程,包括系統(tǒng)架構(gòu)介紹、各個(gè)組件的配置和完整的部署案例。Thanos為Prometheus提供了強(qiáng)大的監(jiān)控解決方案,具備全局查詢、高可用性、動(dòng)態(tài)擴(kuò)展和長期存儲(chǔ)等特性。借助Thanos,我們能夠高效管理大規(guī)模監(jiān)控?cái)?shù)據(jù),并通過豐富的組件和集成功能,構(gòu)建一個(gè)強(qiáng)大而可靠的監(jiān)控生態(tài)系統(tǒng)。我們希望本文能為那些尋求提升監(jiān)控系統(tǒng)性能和擴(kuò)展性的用戶提供有價(jià)值的指導(dǎo)。隨著技術(shù)的不斷進(jìn)步,Thanos將持續(xù)發(fā)展,我們期待它在未來帶來更多創(chuàng)新與可能性。

責(zé)任編輯:武曉燕 來源: 新鈦云服
相關(guān)推薦

2021-08-09 10:20:04

Thanos監(jiān)控架構(gòu)

2021-08-27 10:14:16

Thanos監(jiān)控開源

2022-05-02 18:15:04

KubernetesLinux開源

2019-12-05 10:40:41

DockerMySQL數(shù)據(jù)庫

2016-04-06 10:02:23

手機(jī)微博運(yùn)維監(jiān)控

2022-08-11 08:27:24

Sentry日志監(jiān)控系統(tǒng)

2021-07-13 10:35:00

LinuxNFS服務(wù)器

2011-03-29 13:25:10

Zabbix監(jiān)控

2010-06-01 15:40:07

數(shù)據(jù)庫網(wǎng)絡(luò)部署

2010-05-26 12:57:59

linux 系統(tǒng)監(jiān)控

2022-06-04 07:26:47

Thanos集群Prometheus

2009-01-13 09:32:00

網(wǎng)吧監(jiān)控

2013-02-22 09:49:29

Nagios監(jiān)控性能評(píng)測

2019-06-27 10:17:40

Centos7Pinpoint監(jiān)控

2014-04-04 16:02:54

東華網(wǎng)智IT運(yùn)維監(jiān)控

2014-03-03 09:23:43

Zabbix分布式系統(tǒng)監(jiān)控

2020-10-19 09:50:04

Spinnaker

2022-08-10 10:52:58

Python文件夾

2024-07-24 08:14:07

Nginx監(jiān)控數(shù)據(jù)

2024-02-23 16:10:29

KubernetesPrometheus開源
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)