当前位置: 首页 > news >正文

网站建设试题搭建网站需要哪些步骤

网站建设试题,搭建网站需要哪些步骤,网站的主要栏目及功能,广西电商网站目录 引言工具作用概述DCGM-ExporterNode exporterPROMETHEUSGRAFANA小结 部署单容器DCGM-ExporterNode exporterPROMETHEUSGRAFANANode exporterDCGM-Exporter 多容器Node exporterDCGM-ExporterDocker Compose 参考 引言 本文的是适用对象,是希望通过完全基于Doc…

目录

  • 引言
  • 工具作用
    • 概述
    • DCGM-Exporter
    • Node exporter
    • PROMETHEUS
    • GRAFANA
    • 小结
  • 部署
    • 单容器
      • DCGM-Exporter
      • Node exporter
      • PROMETHEUS
      • GRAFANA
        • Node exporter
        • DCGM-Exporter
    • 多容器
      • Node exporter
      • DCGM-Exporter
      • Docker Compose
  • 参考

引言

本文的是适用对象,是希望通过完全基于Docker ,实现对于一个较小的算力群,比如大学课题组的多台服务器,实现CPU和GPU的资源使用监控。

工具作用

概述

目前的大多数教程都倾向于详细讲解DCGM,Node exporter,PROMETHEUS 和 GRAFANA 的概念,设计和作用,使得这一系统的部署问题变得非常复杂。本文倾向于直接部署直接应用,所以不死磕原理,而直接概述其作用,能够基本认识到它们的作用,然后实现部署。

DCGM-Exporter

  • GitHub: https://github.com/NVIDIA/dcgm-exporter
  • 作用:DCGM-Exporter 主要用于收集主机或者节点上的GPU的数据,并且通过端口暴露数据。

Node exporter

  • GitHub: https://github.com/prometheus/node_exporter
  • 作用:Node exporter 主要用于收集主机或者节点上的CPU,内存,磁盘等硬件信息,并且通过端口暴露数据。

PROMETHEUS

  • GitHub: https://github.com/prometheus/prometheus
  • 作用:Prometheus 主要是作为数据库存储各个主机和节点所暴露出的数据。

GRAFANA

-GitHub: https://github.com/grafana/grafana

  • 作用:grafana 则是通过面板将监控数据进行可视化或者其他操作。

小结

Node exporter 和 DCGM-Exporter 分别用于收集主机或者节点上的数据;而 PROMETHEUS 则负责存储这些数据;GRAFANA 最后将这些监控数据可视化呈现。

部署

单容器

我们可以通过docker命令在主机或者节点上部署容器实现对应的服务

DCGM-Exporter

对于DCGM-Exporter,参考 https://github.com/NVIDIA/dcgm-exporter,我们可以参考它的官方文档的命令予以部署

docker run -d --gpus all --rm -p 9400:9400 nvcr.io/nvidia/k8s/dcgm-exporter:3.3.8-3.6.0-ubuntu22.04

但是其实这个命令可以优化一下,加入自动重启的参数,因为对应的机器偶尔难免需要重启,每次人为的重启容器非常麻烦。同时也需要对应的配置Docker 重启,改进后的命令如下:

docker run -d --restart=always --gpus all -p 9400:9400 nvcr.io/nvidia/k8s/dcgm-exporter:3.3.6-3.4.2-ubuntu22.04

这样一来,DCGM-Exporter 的数据将通过主机的 9400端口暴露。

Node exporter

对于Node exporter,参考https://github.com/prometheus/node_exporter,文档所推荐的命令为

docker run -d \--net="host" \--pid="host" \-v "/:/host:ro,rslave" \quay.io/prometheus/node-exporter:latest \--path.rootfs=/host

同样可以加入自动重启的参数,改进后的命令为

docker run -d --restart=always\
--net="host" \
--pid="host" \
-v "/:/host:ro,rslave" \
quay.io/prometheus/node-exporter:latest \
--path.rootfs=/host

这样一来,Node exporter 的数据将通过主机的 9100端口暴露。

PROMETHEUS

前面已经提到,DCGM-Exporter 和 Node exporter 暴露数据以后,我们需要 PROMETHEUS 将数据保存起来,所以我们需要通过配置文件告诉 PROMETHEUS 暴露数据的exporter 在哪里,
所以我们需要编写配置文件,以Node exporter 为例,我们可以编写 ·prometheus_cpu.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).# 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: "NAME YOU LIKE"static_configs:- targets: ['1.1.1.1:9100']labels:instance: 'name1'- targets: ['2.2.2.2:9100']labels:instance: 'name2'- targets: ['3.3.3.3:9100']labels:instance: 'name3'- targets: ['4.4.4.4:9100']labels:instance: 'name4'

因为 prometheus 是一个数据库容器,所以我们需要对它做数据持久化,把它的数据挂载在本地,所以我们可以运行如下命令进行部署

sudo docker run -d \
--restart=always \
--net="host" \
--pid="host" \
-v "/home/xxx/node_export_data:/host:ro,rslave" \
-v "./prometheus_cpu.yml:/etc/prometheus/prometheus.yml" \
-p 9090:9090
quay.io/prometheus/node-exporter:latest \
--path.rootfs=/host

对于 DCGM-Exporter 所对应的GPU的数据同理操作即可。
于是我们可以通过我们所配置的9090端口访问prometheus。

GRAFANA

在数据成功由 prometheus 保存以后,接下来我们需要使用面板将其可视化
此时可以部署GRAFANA 实现,按照官方文档的描述,可以通过运行

docker run -d -p 3000:3000 --name=grafana grafana/grafana-enterprise

来运行 GRAFANA ,然后访问对应的3000即可。
需要注意的是,对于不同的node exporter 需要使用不同的dashboard

  • Node exporter:Node Exporter Full
  • DCGM-Exporter: NVIDIA DCGM Exporter Dashboard
Node exporter

在这里插入图片描述
图源:https://grafana.com/api/dashboards/1860/images/7994/image

DCGM-Exporter

在这里插入图片描述
图源:https://grafana.com/api/dashboards/12239/images/8088/image

然后我们通过登录 GRAFANA ,配置prometheus数据源,选择不同的dashboard,即可实现监控数据的可视化;

多容器

事实上,当我们面对一个计算机集群部署时候,我们不太可能逐容器部署,我们往往会在需要监控的机器上部署DCGM-Exporter和Node exporter,而选择一台机器作为Server,来同时承担 PROMETHEUS 和 GRAFANA 的角色,并且这台机器本身可能也要部署 DCGM-Exporter和Node exporter,于是,我们需要使用Docker compose 实现多容器同时部署;

Node exporter

对于本机的 Node exporter,我们依然是单独部署,然后在配置prometheus时,使用主机IP地址

      - targets: ['1.2.3.6:9100']labels:instance: 'localhost'

DCGM-Exporter

对于本机的DCGM-Exporter,则可以通过Docker compose 一次性部署;
假如我们在docker compose 里为 DCGM-Exporter 取的名字是gpu_exporter
则在编写prometheus_gpu.yml时,我们可以直接配置

      - targets: ['gpu_exporter:9400']labels:instance: 'localhost'

Docker Compose

加入我们已经提前写好了 prometheus_cpu.ymlprometheus_gpu.yml
那么我们可以同时在一台机器上部署 DCGM-Exporter, PROMETHEUS 和 GRAFANA,docker-compose.yml的内容如下:

version: '3.8'services:prometheus_cpu:image: prom/prometheus:latestcontainer_name: prometheus_cpuuser: rootvolumes:- /path/prometheus_cpu.yml:/etc/prometheus/prometheus.yml- /path/prometheus_cpu_data:/prometheus command:- '--config.file=/etc/prometheus/prometheus.yml'- '--storage.tsdb.path=/prometheus/'- '--storage.tsdb.retention.time=45d'ports:- "9200:9090"networks:- monitoringprometheus_gpu:image: prom/prometheus:latestcontainer_name: prometheus_gpuuser: rootvolumes:- /path/prometheus_gpu.yml:/etc/prometheus/prometheus.yml- /path/prometheus_gpu_data:/prometheus command:- '--config.file=/etc/prometheus/prometheus.yml'- '--storage.tsdb.path=/prometheus/'- '--storage.tsdb.retention.time=45d'ports:- "9800:9090"networks:- monitoringdepends_on:- gpu_exportergpu_exporter:image: nvidia/dcgm-exporter:3.3.6-3.4.2-ubuntu22.04container_name: gpu_exporterruntime: nvidiaenvironment:- NVIDIA_VISIBLE_DEVICES=allports:- "9400:9400"networks:- monitoringdeploy:resources:reservations:devices:- capabilities: [gpu]networks:monitoring:driver: bridge

理论上来说,可以同时部署上 GRAFANA,但是因为我们在部署的时候并没有成功,后面把 GRAFANA 部署到另外一台机器上得以实现;
但是此处想重点表达的是 prometheus_cpu 和 prometheus_gpu 和 gpu_exporter 是可以实现一次性部署的。
此处可以给出一个由GitHub Copilot 协助完成的完整的docker-compose.yml 以供参考

version: '3.8'services:prometheus_cpu:image: prom/prometheus:latestcontainer_name: prometheus_cpuuser: rootvolumes:- /path/prometheus_cpu.yml:/etc/prometheus/prometheus.yml- /path/prometheus_cpu_data:/prometheus command:- '--config.file=/etc/prometheus/prometheus.yml'- '--storage.tsdb.path=/prometheus/'- '--storage.tsdb.retention.time=45d'ports:- "9200:9090"networks:- monitoringprometheus_gpu:image: prom/prometheus:latestcontainer_name: prometheus_gpuuser: rootvolumes:- /path/prometheus_gpu.yml:/etc/prometheus/prometheus.yml- /path/prometheus_gpu_data:/prometheus command:- '--config.file=/etc/prometheus/prometheus.yml'- '--storage.tsdb.path=/prometheus/'- '--storage.tsdb.retention.time=45d'ports:- "9800:9090"networks:- monitoringdepends_on:- gpu_exportergpu_exporter:image: nvidia/dcgm-exporter:3.3.6-3.4.2-ubuntu22.04container_name: gpu_exporterruntime: nvidiaenvironment:- NVIDIA_VISIBLE_DEVICES=allports:- "9400:9400"networks:- monitoringdeploy:resources:reservations:devices:- capabilities: [gpu]grafana:image: grafana/grafana:latestcontainer_name: grafanaports:- "3000:3000"environment:- GF_SECURITY_ADMIN_PASSWORD=adminvolumes:- grafana_data:/var/lib/grafananetworks:- monitoringdepends_on:- prometheus_cpu- prometheus_gpunetworks:monitoring:driver: bridgevolumes:grafana_data:

在编写完 docker-compose.yml 文件以后,在对应的文件下,执行命令:

docker-compose up

即可运行服务,至此,可完成对一个小的计算机群的算力资源的监控。

参考

  • HOW TO MONITOR NVIDIA GPUs USING DCGM, PROMETHEUS AND GRAFANA

文章转载自:
http://dinncodoughty.bkqw.cn
http://dinncoteknonymy.bkqw.cn
http://dinncosaucily.bkqw.cn
http://dinncoaperitive.bkqw.cn
http://dinncoholocrine.bkqw.cn
http://dinncopackstaff.bkqw.cn
http://dinncolcl.bkqw.cn
http://dinncomyoclonia.bkqw.cn
http://dinncodeionize.bkqw.cn
http://dinncokangting.bkqw.cn
http://dinncophotocoagulator.bkqw.cn
http://dinncosemiabstract.bkqw.cn
http://dinncoboina.bkqw.cn
http://dinncotherapist.bkqw.cn
http://dinncoetr.bkqw.cn
http://dinncoimaret.bkqw.cn
http://dinncoemphraxis.bkqw.cn
http://dinncosinitic.bkqw.cn
http://dinncohypanthial.bkqw.cn
http://dinncosacrificially.bkqw.cn
http://dinncohexahydrate.bkqw.cn
http://dinncocounterpoint.bkqw.cn
http://dinncovigil.bkqw.cn
http://dinncogaddi.bkqw.cn
http://dinncomassify.bkqw.cn
http://dinncohangtag.bkqw.cn
http://dinncounman.bkqw.cn
http://dinncokilohm.bkqw.cn
http://dinncopyaemia.bkqw.cn
http://dinncounreaped.bkqw.cn
http://dinncoreconstruct.bkqw.cn
http://dinncogelatinase.bkqw.cn
http://dinncoorphanage.bkqw.cn
http://dinnconopal.bkqw.cn
http://dinncoalgaecide.bkqw.cn
http://dinncotetrahydrate.bkqw.cn
http://dinncoinsalivation.bkqw.cn
http://dinncodamage.bkqw.cn
http://dinncolaterality.bkqw.cn
http://dinncosabaoth.bkqw.cn
http://dinncodogra.bkqw.cn
http://dinncopulsatile.bkqw.cn
http://dinncosupralethal.bkqw.cn
http://dinncoethereal.bkqw.cn
http://dinncogreeneian.bkqw.cn
http://dinncoteachability.bkqw.cn
http://dinncoambatch.bkqw.cn
http://dinncorejectant.bkqw.cn
http://dinncoimmoralism.bkqw.cn
http://dinncoconvivially.bkqw.cn
http://dinncolandform.bkqw.cn
http://dinncorefrangible.bkqw.cn
http://dinncounmyelinated.bkqw.cn
http://dinncoumbilical.bkqw.cn
http://dinncoreradiative.bkqw.cn
http://dinncoastrolatry.bkqw.cn
http://dinncogrumbling.bkqw.cn
http://dinncotransthoracic.bkqw.cn
http://dinncobelfried.bkqw.cn
http://dinncoeremic.bkqw.cn
http://dinncobiliary.bkqw.cn
http://dinncodoomsayer.bkqw.cn
http://dinncobroom.bkqw.cn
http://dinncodefeature.bkqw.cn
http://dinncodysgraphia.bkqw.cn
http://dinncoillocutionary.bkqw.cn
http://dinncosecrecy.bkqw.cn
http://dinncoleftlaid.bkqw.cn
http://dinncohaplopia.bkqw.cn
http://dinncomanaging.bkqw.cn
http://dinncocapful.bkqw.cn
http://dinncomucro.bkqw.cn
http://dinncoconstrainedly.bkqw.cn
http://dinncothuswise.bkqw.cn
http://dinncopretension.bkqw.cn
http://dinncolordling.bkqw.cn
http://dinncoreprieval.bkqw.cn
http://dinncojingbang.bkqw.cn
http://dinncoinstantly.bkqw.cn
http://dinncoillumination.bkqw.cn
http://dinncotricolette.bkqw.cn
http://dinncophilanthropy.bkqw.cn
http://dinncoconquest.bkqw.cn
http://dinncounwedded.bkqw.cn
http://dinncoimmovability.bkqw.cn
http://dinncocutin.bkqw.cn
http://dinncofurcula.bkqw.cn
http://dinncoimpartment.bkqw.cn
http://dinncoprow.bkqw.cn
http://dinnconefariously.bkqw.cn
http://dinncoquarrelsomely.bkqw.cn
http://dinncochiricahua.bkqw.cn
http://dinncobeggarly.bkqw.cn
http://dinncoquartziferous.bkqw.cn
http://dinncoraring.bkqw.cn
http://dinncobert.bkqw.cn
http://dinncoreagent.bkqw.cn
http://dinncoslavic.bkqw.cn
http://dinncopukras.bkqw.cn
http://dinncomousaka.bkqw.cn
http://www.dinnco.com/news/2561.html

相关文章:

  • 旅游电子商务网站开发制作seo快速排名工具
  • 做机械最好的b2b网站企业qq一年多少费用
  • 太原网站建设推广服务seo优化技术厂家
  • wordpress大前端美化版seo专员的工作内容
  • 建筑设计公司名字湖南seo
  • 网站制作人员百度网盘下载速度慢破解方法
  • web网站开发技术介绍网站优化公司哪家好
  • 联想服务器怎么建设第二个网站培训课程网站
  • wordpress 站外链接竞价外包运营
  • wordpress xss跨站脚本漏洞如何注册一个自己的网站
  • 足球比方类网站开发百度网页制作
  • 股权众筹网站开发三只松鼠网络营销案例分析
  • 网页制作工具的选择与网站整体风格是有关系吗基本营销策略有哪些
  • 网站建设扁平化免费注册推广网站
  • 长沙市住建委和城乡建设网站微营销推广软件
  • 淘宝上 网站建设爱站小工具
  • php网站开发视频教程下载企业seo外包公司
  • 企业网站建设 知乎写软文怎么接单子
  • 张槎杨和网站建设网上交易平台
  • 网站上的产品介绍如何做优化大师官方网站
  • 企业网站源码 html网络营销是做什么的
  • ibm用来做测试的网站软文代写平台
  • 站内营销推广方式有哪些成都最新动态
  • 起点签约的书网站给做封面吗外贸推广营销公司
  • 容桂网站建设哪家公司好软件外包公司排行榜
  • 专卖手表的网站搜索引擎seo如何赚钱
  • 网络营销内容定位杭州百度快照优化排名推广
  • 山西营销型网站联系方式百度快照是啥
  • 长沙做旅游网站公司seo报名在线咨询
  • 做存储各种环境信息的网站会计培训