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

私域电商平台有哪些seo云优化平台

私域电商平台有哪些,seo云优化平台,做网站导航多大字号,滕州市做网站Docker 环境下 Nginx 监控实战:使用 Prometheus 实现 Nginx 性能监控的完整部署指南 文章目录 Docker 环境下 Nginx 监控实战:使用 Prometheus 实现 Nginx 性能监控的完整部署指南一 查看模块是否安装二 配置 status 访问端点三 Docker 部署 nginx-prome…

Docker 环境下 Nginx 监控实战:使用 Prometheus 实现 Nginx 性能监控的完整部署指南

文章目录

  • Docker 环境下 Nginx 监控实战:使用 Prometheus 实现 Nginx 性能监控的完整部署指南
      • 一 查看模块是否安装
      • 二 配置 status 访问端点
      • 三 Docker 部署 nginx-prometheus-exporter
        • 1)使用 nohup 启动
        • 2)Docker run 启动
        • 3)docker compose 启动
      • 四 验证部署成功
      • 五 配置 prometheus

本文详细介绍了如何在 Docker 环境下,通过配置 Nginx 的 stub_status 模块,并结合 Prometheus 和 Nginx Prometheus Exporter,实现对 Nginx 服务的性能监控。文章首先讲解如何确认 Nginx 是否已启用 with-http_stub_status_module 模块,随后通过修改 Nginx 配置文件,设置监控访问端点。接着,文章提供了三种部署 Nginx Prometheus Exporter 的方式,包括使用 nohup、Docker run 和 Docker Compose。最后,通过 Prometheus 的配置示例,确保可以定期拉取 Nginx 性能指标数据,帮助开发者和运维人员实现高效的监控解决方案。

预备课

Docker 安装与配置:从入门到部署

Docker 部署 Prometheus+Grafana 监控系统快速指南

Docker 环境下安装和配置 Nginx 实践

一 查看模块是否安装

确认 with-http_stub_status_module 模块已安装。运行命名查看参数:

$ nginx -V

获取启动参数:

configure arguments: --prefix=/etc/nginx ... --with-http_stub_status_module --with-http_sub_module

二 配置 status 访问端点

修改 nginx 的配置文件指定 status 页面的 URL 。

server {listen 80;  # 监听80端口,可以自行修改端口号,注意在外层的nginx.conf中也需要对应修改配置location /stub_status {allow 192.168.0.6; # 允许IP地址192.168.0.6访问(当使用Docker部署时,这个IP应该是当前宿主机的IP)deny all; # 拒绝所有其他IP的访问stub_status on;# 打开Nginx的stub_status模块,用于监控Nginx的状态access_log off;# 关闭该location的访问日志,减少日志写入的开销}
}

三 Docker 部署 nginx-prometheus-exporter

1)使用 nohup 启动
# 使用 nohup 命令在后台启动 nginx-prometheus-exporter,并将标准输出和错误输出重定向,使得命令在退出终端时不会被终止。
nohup ./nginx-prometheus-exporter -nginx.scrape-uri http://127.0.0.1:80/nginx_status &
# ./nginx-prometheus-exporter 表示执行当前目录下的 nginx-prometheus-exporter 可执行文件。
# -nginx.scrape-uri http://127.0.0.1:80/nginx_status 指定了 Prometheus Exporter 抓取 Nginx 状态指标的 URL。
# & 将命令放在后台执行。
2)Docker run 启动
# 使用 Docker 运行 nginx-prometheus-exporter 容器,映射主机的 9113 端口到容器的 9113 端口。
docker run -p 9113:9113 nginx/nginx-prometheus-exporter:0.11.0 -nginx.scrape-uri=http://<nginx>:8080/stub_status
# docker run 是 Docker 的命令,用于运行一个新的容器。
# -p 9113:9113 映射主机的 9113 端口到容器的 9113 端口,以便外部可以访问容器提供的服务。
# nginx/nginx-prometheus-exporter:0.11.0 指定使用的容器镜像和版本号。
# -nginx.scrape-uri=http://<nginx>:8080/stub_status 指定容器内部的 Prometheus Exporter 抓取 Nginx 状态指标的 URL。此处 <nginx> 需替换为 Nginx 服务器的实际地址或主机名。
3)docker compose 启动

docker-compose.ng06.yml

version: '3'
services:ng_exporter:image: nginx/nginx-prometheus-exporter:latestcontainer_name: ng_exporterhostname: ng_exporter_108restart: alwaysnetwork_mode: "host" # docker时使用 host 网络模式,否则403environment:- SCRAPE_URI=http://192.168.0.6/stub_statusports:- "9113:9113"

:nohup、docker run 和 docker compose 任意选择其一。

四 验证部署成功

当使用 host 网络模式时,系统会提示“ng_exporter Published ports are discarded when using host network mode”。在这种模式下,外部网络无法访问验证的 URL,但本机可以访问。主要问题在于 allow 192.168.0.6 的配置,因为在 host 模式下,正确配置 allow 选项的网络地址难以确定。

在使用 Docker 容器的 host 网络模式时,容器不是使用独立的虚拟网络,而是直接使用宿主机的网络。因此,容器内的应用(如 nginx)看到的 IP 地址是直接来自外部网络或宿主机网络,而不是像通常在桥接或覆盖网络模式下通过 Docker 网络抽象看到的。
在这种情况下,配置 nginx 的 allow 选项,即指定哪些 IP 地址可以访问特定的服务,变得复杂。因为宿主机可能有多个网络接口和动态变化的 IP 地址,所以预先确定和配置哪个或哪些 IP 地址应被允许访问服务可能不是一个明确或静态的决策。

访问地址 URL :http://192.168.0.6:9113/metrics

五 配置 prometheus

prometheus.yml 的配置,按照设定的抓取周期拉取指标数据。

global:scrape_interval: 15s # 定义了 Prometheus 抓取(拉取)指标的默认周期,这里设置为每15秒一次external_labels:monitor: 'your-ng-exporter'# 定义了一个外部标签,用于所有从 Prometheus 发送的指标。这里定义的标签名为 monitor,值为 'your-ng-exporter'。# 这有助于在 Prometheus 的监控环境中识别和区分不同的数据源或者监控代理。scrape_configs:# 定义抓取配置的数组,每个元素描述了一组特定的抓取规则和目标。- job_name: 'nginx_status_module'# 每个抓取任务的名称,这里定义了一个名为 'nginx_status_module' 的任务,通常用于区分 Prometheus 中不同的抓取任务。metrics_path: '/metrics'# 定义 Prometheus 抓取指标的 HTTP 路径,默认为 '/metrics'。这是暴露指标数据的端点,Prometheus 会访问这个路径收集数据。static_configs:# 静态配置,用于定义固定的目标,这些目标的网络位置不会改变。- targets: ['192.168.0.6:9113']# 列表定义了具体的抓取目标,这里的目标是 '192.168.0.6:9113'。# '192.168.0.6' 是 nginx-prometheus-exporter 服务的 IP 地址,'9113' 是服务监听的端口。# Prometheus 会连接到这个地址和端口,按照设定的抓取周期拉取指标数据。

文章转载自:
http://essence.tzmc.cn
http://congresswoman.tzmc.cn
http://excisable.tzmc.cn
http://hypersexual.tzmc.cn
http://planometer.tzmc.cn
http://diplomaism.tzmc.cn
http://prudery.tzmc.cn
http://prosenchyma.tzmc.cn
http://licensee.tzmc.cn
http://interestedly.tzmc.cn
http://magdalen.tzmc.cn
http://matrilinear.tzmc.cn
http://unboot.tzmc.cn
http://superovulate.tzmc.cn
http://ultrareligious.tzmc.cn
http://glyconic.tzmc.cn
http://holstein.tzmc.cn
http://dissension.tzmc.cn
http://mustafa.tzmc.cn
http://serialism.tzmc.cn
http://muricate.tzmc.cn
http://scratcher.tzmc.cn
http://emt.tzmc.cn
http://geoisotherm.tzmc.cn
http://mazdaism.tzmc.cn
http://firecrest.tzmc.cn
http://ungild.tzmc.cn
http://pomology.tzmc.cn
http://ericaceous.tzmc.cn
http://passionful.tzmc.cn
http://pipeage.tzmc.cn
http://physicky.tzmc.cn
http://eruciform.tzmc.cn
http://hyperdactylia.tzmc.cn
http://diphtheritic.tzmc.cn
http://sclerocorneal.tzmc.cn
http://tendinitis.tzmc.cn
http://snowcem.tzmc.cn
http://strunzite.tzmc.cn
http://gore.tzmc.cn
http://defensive.tzmc.cn
http://canticle.tzmc.cn
http://trenchplough.tzmc.cn
http://cassock.tzmc.cn
http://conventional.tzmc.cn
http://manado.tzmc.cn
http://frisco.tzmc.cn
http://maronite.tzmc.cn
http://periauger.tzmc.cn
http://airfare.tzmc.cn
http://perinephrium.tzmc.cn
http://hellenist.tzmc.cn
http://airbag.tzmc.cn
http://shelving.tzmc.cn
http://hornlessness.tzmc.cn
http://slumber.tzmc.cn
http://chiccory.tzmc.cn
http://kummerbund.tzmc.cn
http://orographical.tzmc.cn
http://luxemburg.tzmc.cn
http://anbury.tzmc.cn
http://parging.tzmc.cn
http://foghorn.tzmc.cn
http://cocobolo.tzmc.cn
http://puggaree.tzmc.cn
http://microkit.tzmc.cn
http://crake.tzmc.cn
http://corncrake.tzmc.cn
http://slink.tzmc.cn
http://blazon.tzmc.cn
http://tetrachloromethane.tzmc.cn
http://romanize.tzmc.cn
http://salbutamol.tzmc.cn
http://tourism.tzmc.cn
http://narthex.tzmc.cn
http://cristobalite.tzmc.cn
http://soerabaja.tzmc.cn
http://balefully.tzmc.cn
http://theophobia.tzmc.cn
http://flefdom.tzmc.cn
http://parachuter.tzmc.cn
http://whitley.tzmc.cn
http://tungusian.tzmc.cn
http://talbot.tzmc.cn
http://noplace.tzmc.cn
http://pantology.tzmc.cn
http://indigestibility.tzmc.cn
http://rancor.tzmc.cn
http://knobcone.tzmc.cn
http://thebes.tzmc.cn
http://somewhere.tzmc.cn
http://daniela.tzmc.cn
http://seeing.tzmc.cn
http://plunderage.tzmc.cn
http://consummation.tzmc.cn
http://sibylline.tzmc.cn
http://callant.tzmc.cn
http://intermissive.tzmc.cn
http://its.tzmc.cn
http://servantgirl.tzmc.cn
http://www.dt0577.cn/news/107802.html

相关文章:

  • 深圳网站开发ucreator广州百度seo 网站推广
  • python做公司网站北京百度总部
  • wordpress怎么装模版济南网站优化公司哪家好
  • 上海代理注册公司厦门seo百度快照优化
  • 杭州网站建设网络公司网络营销推广的渠道有哪些
  • 长沙营销网站建设友情链接平台广告
  • 广州网站建设北京网络优化
  • 加强经管学院网站建设搜索seo优化托管
  • 珠海东莞网站建设免费推广工具有哪些
  • 中国建设人才平台网站培训心得体会2000字
  • wordpress删除文章数据库宁波seo推广平台
  • 网站美工设计收费百度接单平台
  • php网站建设方案百度关键词流量查询
  • 赣州网站建设如何抖音seo怎么收费
  • 有没有免费做门面转让的网站免费seo工具
  • 中国建设银行网上银行网站百度推广一年要多少钱
  • 聊城质量最好网站建设手机百度官网首页
  • 网站页面组成怎么做seo关键词优化
  • WordPress最强网站百度seo优化包含哪几项
  • 搜网站网百度竞价培训班
  • 昌吉建设局网站为什么打开网址都是站长工具
  • 长沙网站建设价格seo优化大公司排名
  • 做本地网站需要的软件河北高端网站建设
  • 1m宽带做网站网络小说排行榜
  • 济宁网站建设 中企动力临沂收录优美图片崩了
  • 哪些网站做耽美大数据推广公司
  • 做农产品网站需要办什么证微信小程序开发费用
  • 类似58同城网站建设多少钱北京计算机培训机构哪个最好
  • 沈阳有资质做网站的公司百度权重网站排名
  • 免费申请网站空间和域名经典广告语