{"id":38972,"date":"2025-05-21T22:03:31","date_gmt":"2025-05-21T14:03:31","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/38972.html"},"modified":"2025-05-21T22:03:31","modified_gmt":"2025-05-21T14:03:31","slug":"prometheus%e5%ae%9e%e6%88%98%e6%95%99%e7%a8%8b%ef%bc%9ak8s%e5%b9%b3%e5%8f%b0-mysql%e7%9b%91%e6%8e%a7%e6%a1%88%e4%be%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/38972.html","title":{"rendered":"Prometheus\u5b9e\u6218\u6559\u7a0b\uff1ak8s\u5e73\u53f0-Mysql\u76d1\u63a7\u6848\u4f8b"},"content":{"rendered":"<p>\u914d\u7f6e\u6587\u4ef6\u4f18\u5316\u540e\u7684 Prometheus \u81ea\u52a8\u53d1\u73b0 MySQL \u5b9e\u4f8b\u7684\u5b8c\u6574 YAML \u6587\u4ef6\u3002\u8be5\u914d\u7f6e\u5305\u62ec&#xff1a;<\/p>\n<li>MySQL Exporter \u90e8\u7f72&#xff1a;\u4f7f\u7528 ConfigMap \u63d0\u4f9b MySQL \u8fde\u63a5\u4fe1\u606f\u3002<\/li>\n<li>Prometheus \u81ea\u52a8\u53d1\u73b0&#xff1a;\u901a\u8fc7 Kubernetes \u670d\u52a1\u53d1\u73b0\u81ea\u52a8\u6293\u53d6 MySQL \u5b9e\u4f8b\u3002<\/li>\n<hr \/>\n<h4 id=\"1\u3001mysql-\u914d\u7f6e\u6587\u4ef6-&#xff08;mysql-deploymentyaml&#xff09;\">1\u3001mysql \u914d\u7f6e\u6587\u4ef6 &#xff08;mysql-deployment.yaml&#xff09;<\/h4>\n<p>apiVersion: apps\/v1<br \/>\nkind: Deployment<br \/>\nmetadata:<br \/>\n  name: mysql<br \/>\n  labels:<br \/>\n    app: mysql<br \/>\nspec:<br \/>\n  replicas: 3<br \/>\n  selector:<br \/>\n    matchLabels:<br \/>\n      app: mysql<br \/>\n  template:<br \/>\n    metadata:<br \/>\n      labels:<br \/>\n        app: mysql<br \/>\n      annotations:<br \/>\n        prometheus.io\/scrape: &#034;true&#034;  # \u5141\u8bb8 Prometheus \u6293\u53d6<br \/>\n        prometheus.io\/port: &#034;9104&#034;    # MySQL Exporter \u66b4\u9732\u7684\u7aef\u53e3<br \/>\n    spec:<br \/>\n      containers:<br \/>\n      &#8211; name: mysql<br \/>\n        image: harbor.fq.com\/public\/mysql:9.1.0  # \u4f7f\u7528\u5b98\u65b9 MySQL \u955c\u50cf<br \/>\n        env:<br \/>\n        &#8211; name: MYSQL_ROOT_PASSWORD<br \/>\n          value: &#034;password&#034;  # \u8bbe\u7f6e MySQL root \u5bc6\u7801<br \/>\n        ports:<br \/>\n        &#8211; containerPort: 3306  # MySQL \u9ed8\u8ba4\u7aef\u53e3<br \/>\n&#8212;<br \/>\napiVersion: v1<br \/>\nkind: Service<br \/>\nmetadata:<br \/>\n  name: mysql-service<br \/>\n  labels:<br \/>\n    app: mysql<br \/>\n  annotations:<br \/>\n    prometheus.io\/scrape: &#034;true&#034;  # \u5141\u8bb8 Prometheus \u6293\u53d6<br \/>\n    prometheus.io\/port: &#034;9104&#034;    # MySQL Exporter \u66b4\u9732\u7684\u7aef\u53e3<br \/>\nspec:<br \/>\n  selector:<br \/>\n    app: mysql<br \/>\n  ports:<br \/>\n  &#8211; name: mysql<br \/>\n    protocol: TCP<br \/>\n    port: 3306<br \/>\n    targetPort: 3306 <\/p>\n<p>cat mysql-statefulset.yaml<\/p>\n<p>apiVersion: apps\/v1<br \/>\nkind: StatefulSet<br \/>\nmetadata:<br \/>\n  name: mysql<br \/>\n  labels:<br \/>\n    app: mysql<br \/>\nspec:<br \/>\n  serviceName: &#034;mysql&#034;<br \/>\n  replicas: 1<br \/>\n  selector:<br \/>\n    matchLabels:<br \/>\n      app: mysql<br \/>\n  template:<br \/>\n    metadata:<br \/>\n      labels:<br \/>\n        app: mysql<br \/>\n      annotations:<br \/>\n        prometheus.io\/scrape: &#034;true&#034;  # \u5141\u8bb8 Prometheus \u6293\u53d6<br \/>\n        prometheus.io\/port: &#034;9104&#034;    # MySQL Exporter \u66b4\u9732\u7684\u7aef\u53e3<br \/>\n    spec:<br \/>\n      containers:<br \/>\n      &#8211; name: mysql<br \/>\n        image: harbor.fq.com\/public\/mysql:9.1.0  # MySQL \u955c\u50cf<br \/>\n        env:<br \/>\n        &#8211; name: MYSQL_ROOT_PASSWORD<br \/>\n          value: &#034;password&#034;  # \u8bbe\u7f6e MySQL root \u5bc6\u7801<br \/>\n        ports:<br \/>\n        &#8211; containerPort: 3306  # MySQL \u9ed8\u8ba4\u7aef\u53e3<br \/>\n        volumeMounts:<br \/>\n        &#8211; name: mysql-data<br \/>\n          mountPath: \/var\/lib\/mysql  # MySQL \u6570\u636e\u5b58\u50a8\u8def\u5f84<br \/>\n      volumes:<br \/>\n      &#8211; name: mysql-data<br \/>\n        emptyDir: {}  # \u4f7f\u7528\u7a7a\u76ee\u5f55&#xff0c;\u4e0d\u6301\u4e45\u5316\u6570\u636e<\/p>\n<p>&#8212;<br \/>\napiVersion: v1<br \/>\nkind: Service<br \/>\nmetadata:<br \/>\n  name: mysql-service<br \/>\n  labels:<br \/>\n    app: mysql<br \/>\n  annotations:<br \/>\n    prometheus.io\/scrape: &#034;true&#034;  # \u5141\u8bb8 Prometheus \u6293\u53d6<br \/>\n    prometheus.io\/port: &#034;9104&#034;    # MySQL Exporter \u66b4\u9732\u7684\u7aef\u53e3<br \/>\nspec:<br \/>\n  selector:<br \/>\n    app: mysql<br \/>\n  ports:<br \/>\n  &#8211; name: mysql<br \/>\n    protocol: TCP<br \/>\n    port: 3306<br \/>\n    targetPort: 3306<br \/>\n  type: ClusterIP  # \u5185\u90e8\u670d\u52a1 <\/p>\n<h4 id=\"2\u3001\u767b\u5f55mysql&#xff0c;\u5e76\u521b\u5efamysql_exporter\u7528\u6237\">2\u3001\u767b\u5f55mysql&#xff0c;\u5e76\u521b\u5efa\u2018mysql_exporter\u2019\u7528\u6237<\/h4>\n<p>2.1\u3001\u67e5\u770bmysql\u5bb9\u5668\u540d\u79f0&#xff0c;\u767b\u5f55\u5230\u5bb9\u5668\u5185<\/p>\n<p>[root&#064;k8s-master01 example]# kubectl get pod<br \/>\nNAME                                  READY   STATUS    RESTARTS   AGE<br \/>\nkuard-d574f5b78-r2l77                 1\/1     Running   0          278d<br \/>\nmysql-0                               1\/1     Running   0          6s<\/p>\n<p>[root&#064;k8s-master01 example]# kubectl exec -it mysql-0 &#8212; bash<br \/>\nbash-5.1#  <\/p>\n<p>2.2\u3001\u786e\u4fdd mysql_exporter \u7528\u6237\u5b58\u5728**<\/p>\n<p>\u4f7f\u7528 MySQL root \u7528\u6237\u767b\u5f55\u5e76\u68c0\u67e5 mysql_exporter \u7528\u6237&#xff1a;<\/p>\n<p>SELECT user, host FROM mysql.user WHERE user &#061; &#039;mysql_exporter&#039;; <\/p>\n<p>2.3\u3001\u5982\u679c\u6ca1\u6709\u8be5\u7528\u6237&#xff0c;\u5219\u521b\u5efa&#xff1a;<\/p>\n<p>CREATE USER &#039;mysql_exporter&#039;&#064;&#039;%&#039; IDENTIFIED BY &#039;your_password&#039;;<br \/>\nGRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO &#039;mysql_exporter&#039;&#064;&#039;%&#039;;<br \/>\nFLUSH PRIVILEGES; <\/p>\n<p>\u5b9e\u64cd&#xff1a;<\/p>\n<p>CREATE USER &#039;mysql_exporter&#039;&#064;&#039;%&#039; IDENTIFIED BY &#039;mysql123!&#039;;<br \/>\nGRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO &#039;mysql_exporter&#039;&#064;&#039;%&#039;;<br \/>\nFLUSH PRIVILEGES; <\/p>\n<p>![[IMG-5\u3001k8s\u5e73\u53f0&#xff1a;mysql \u76d1\u63a7\u6848\u4f8b-20250318102405307.png]]<\/p>\n<p>mysql&gt; SELECT user, host FROM mysql.user WHERE user &#061; &#039;mysql_exporter&#039;;<br \/>\nEmpty set (0.00 sec)<\/p>\n<p>mysql&gt; CREATE USER &#039;mysql_exporter&#039;&#064;&#039;%&#039; IDENTIFIED BY &#039;mysql123!&#039;;<br \/>\nQuery OK, 0 rows affected (0.01 sec)<\/p>\n<p>mysql&gt; GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO &#039;mysql_exporter&#039;&#064;&#039;%&#039;;<br \/>\nQuery OK, 0 rows affected (0.01 sec)<\/p>\n<p>mysql&gt; FLUSH PRIVILEGES;<br \/>\nQuery OK, 0 rows affected (0.00 sec)<\/p>\n<p>mysql&gt; SELECT user, host FROM mysql.user WHERE user &#061; &#039;mysql_exporter&#039;;<br \/>\n&#043;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#043;<br \/>\n| user           | host |<br \/>\n&#043;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#043;<br \/>\n| mysql_exporter | %    |<br \/>\n&#043;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#043;<br \/>\n1 row in set (0.00 sec)<\/p>\n<p>mysql&gt; <\/p>\n<p>\u26a0 \u6ce8\u610f&#xff1a;\u786e\u4fdd your_password \u4e0e mysqld-exporter \u914d\u7f6e\u7684\u5bc6\u7801\u5339\u914d\u3002<\/p>\n<h4 id=\"4-mysql-exporter-\u914d\u7f6e\u6587\u4ef6-mysql-exporter-configyaml\">4. MySQL Exporter \u914d\u7f6e\u6587\u4ef6 (mysql-exporter-config.yaml)<\/h4>\n<p>apiVersion: v1<br \/>\nkind: ConfigMap<br \/>\nmetadata:<br \/>\n  name: mysql-exporter-config<br \/>\ndata:<br \/>\n  .my.cnf: |-<br \/>\n    [client]<br \/>\n    user &#061; mysql_exporter<br \/>\n    password &#061; mysql123!<\/p>\n<p>    [client.servers]<br \/>\n    user &#061; mysql_exporter<br \/>\n    password &#061; mysql123! <\/p>\n<h4 id=\"5-mysql-exporter-\u90e8\u7f72\u6587\u4ef6-mysql-exporter-deploymentyaml\">5. MySQL Exporter \u90e8\u7f72\u6587\u4ef6 (mysql-exporter-deployment.yaml)<\/h4>\n<p>apiVersion: apps\/v1<br \/>\nkind: Deployment<br \/>\nmetadata:<br \/>\n  name: mysql-exporter<br \/>\n  labels:<br \/>\n    app: mysql-exporter<br \/>\nspec:<br \/>\n  replicas: 1<br \/>\n  selector:<br \/>\n    matchLabels:<br \/>\n      app: mysql-exporter<br \/>\n  template:<br \/>\n    metadata:<br \/>\n      labels:<br \/>\n        app: mysql-exporter<br \/>\n      annotations:<br \/>\n        prometheus.io\/scrape: &#034;true&#034;  # \u5141\u8bb8 Prometheus \u6293\u53d6<br \/>\n        prometheus.io\/port: &#034;9104&#034;    # MySQL Exporter \u66b4\u9732\u7684\u7aef\u53e3<br \/>\n    spec:<br \/>\n      volumes:<br \/>\n      &#8211; name: mysql-exporter-config<br \/>\n        configMap:<br \/>\n          name: mysql-exporter-config<br \/>\n          items:<br \/>\n          &#8211; key: .my.cnf<br \/>\n            path: .my.cnf<br \/>\n      containers:<br \/>\n      &#8211; name: mysql-exporter<br \/>\n        image: harbor.fq.com\/prometheus\/mysql-exporter:v0.16.0<br \/>\n        command:<br \/>\n        &#8211; mysqld_exporter<br \/>\n        &#8211; &#8211;config.my-cnf&#061;\/etc\/mysql-exporter\/.my.cnf  # \u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\u8def\u5f84<br \/>\n        securityContext:<br \/>\n          runAsUser: 0  # \u4ee5 root \u7528\u6237\u8fd0\u884c<br \/>\n        ports:<br \/>\n        &#8211; containerPort: 9104  # MySQL Exporter \u9ed8\u8ba4\u7aef\u53e3<br \/>\n        volumeMounts:<br \/>\n        &#8211; name: mysql-exporter-config<br \/>\n          mountPath: \/etc\/mysql-exporter\/.my.cnf<br \/>\n          subPath: .my.cnf<br \/>\n&#8212;<br \/>\napiVersion: v1<br \/>\nkind: Service<br \/>\nmetadata:<br \/>\n  name: mysql-exporter-service<br \/>\n  labels:<br \/>\n    app: mysql-exporter<br \/>\n  annotations:<br \/>\n    prometheus.io\/scrape: &#034;true&#034;  # \u5141\u8bb8 Prometheus \u6293\u53d6<br \/>\n    prometheus.io\/port: &#034;9104&#034;    # MySQL Exporter \u66b4\u9732\u7684\u7aef\u53e3<br \/>\nspec:<br \/>\n  selector:<br \/>\n    app: mysql-exporter<br \/>\n  ports:<br \/>\n  &#8211; protocol: TCP<br \/>\n    port: 9104<br \/>\n    targetPort: 9104<br \/>\n  type: ClusterIP <\/p>\n<hr \/>\n<h4 id=\"6-prometheus-\u81ea\u52a8\u53d1\u73b0\u914d\u7f6e-prometheusyml\">6. Prometheus \u81ea\u52a8\u53d1\u73b0\u914d\u7f6e (prometheus.yml)<\/h4>\n<p>scrape_configs:<br \/>\n  &#8211; job_name: &#039;mysql&#039;<br \/>\n    kubernetes_sd_configs:<br \/>\n      &#8211; role: endpoints  # \u4ece Kubernetes Endpoints \u53d1\u73b0\u670d\u52a1<br \/>\n    relabel_configs:<br \/>\n      # \u53ea\u6293\u53d6\u5e26\u6709 &#096;prometheus.io\/scrape: &#034;true&#034;&#096; \u6ce8\u89e3\u7684\u670d\u52a1<br \/>\n      &#8211; source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]<br \/>\n        action: keep<br \/>\n        regex: true<\/p>\n<p>      # \u66ff\u6362\u76ee\u6807\u5730\u5740\u4e3a\u670d\u52a1\u7684 IP \u548c\u6307\u5b9a\u7aef\u53e3&#xff08;9104&#xff09;<br \/>\n      &#8211; source_labels: [__meta_kubernetes_endpoint_address_target_kind, __meta_kubernetes_endpoint_address_target_name]<br \/>\n        action: keep<br \/>\n        regex: Pod;(.*mysql-exporter.*)  # \u4ec5\u6293\u53d6\u540d\u79f0\u5305\u542b &#034;mysql-exporter&#034; \u7684 Pod<br \/>\n      &#8211; source_labels: [__meta_kubernetes_pod_ip]<br \/>\n        action: replace<br \/>\n        target_label: __address__<br \/>\n        replacement: $1:9104  # \u6307\u5b9a MySQL Exporter \u7684\u7aef\u53e3\u4e3a 9104<\/p>\n<p>      # \u6dfb\u52a0 Kubernetes \u670d\u52a1\u7684 app \u6807\u7b7e<br \/>\n      &#8211; source_labels: [__meta_kubernetes_service_label_app]<br \/>\n        action: replace<br \/>\n        target_label: app<\/p>\n<p>      # \u6dfb\u52a0 Kubernetes \u547d\u540d\u7a7a\u95f4\u6807\u7b7e<br \/>\n      &#8211; source_labels: [__meta_kubernetes_namespace]<br \/>\n        action: replace<br \/>\n        target_label: namespace<\/p>\n<p>      # \u6dfb\u52a0 Kubernetes \u670d\u52a1\u540d\u79f0\u6807\u7b7e<br \/>\n      &#8211; source_labels: [__meta_kubernetes_service_name]<br \/>\n        action: replace<br \/>\n        target_label: service<\/p>\n<p>      # \u6dfb\u52a0 Kubernetes Pod \u540d\u79f0\u6807\u7b7e<br \/>\n      &#8211; source_labels: [__meta_kubernetes_pod_name]<br \/>\n        action: replace<br \/>\n        target_label: pod<\/p>\n<p>      # \u6dfb\u52a0 Kubernetes \u8282\u70b9\u540d\u79f0\u6807\u7b7e<br \/>\n      &#8211; source_labels: [__meta_kubernetes_pod_node_name]<br \/>\n        action: replace<br \/>\n        target_label: node<\/p>\n<p>      # \u6dfb\u52a0\u5b9e\u4f8b\u6807\u7b7e&#xff08;\u7528\u4e8e\u533a\u5206\u4e0d\u540c\u7684 MySQL \u5b9e\u4f8b&#xff09;<br \/>\n      &#8211; source_labels: [__meta_kubernetes_pod_ip]<br \/>\n        action: replace<br \/>\n        target_label: instance <\/p>\n<hr \/>\n<h4 id=\"7-\u90e8\u7f72\u6b65\u9aa4\">7. \u90e8\u7f72\u6b65\u9aa4<\/h4>\n<li>\n<p>\u521b\u5efa ConfigMap&#xff1a;<\/p>\n<p> kubectl apply -f mysql-exporter-config.yaml <\/li>\n<li>\n<p>\u90e8\u7f72 MySQL Exporter&#xff1a;<\/p>\n<p> kubectl apply -f mysql-exporter-deployment.yaml <\/li>\n<li>\n<p>\u66f4\u65b0 Prometheus \u914d\u7f6e\u6587\u4ef6&#xff08;prometheus.yml&#xff09;&#xff0c;\u6dfb\u52a0 MySQL \u7684\u81ea\u52a8\u53d1\u73b0\u914d\u7f6e\u3002<\/p>\n<\/li>\n<li>\n<p>\u91cd\u542f Prometheus \u4ee5\u52a0\u8f7d\u65b0\u914d\u7f6e\u3002<\/p>\n<\/li>\n<hr \/>\n<h4 id=\"8-\u9a8c\u8bc1\">8. \u9a8c\u8bc1<\/h4>\n<li>\n<p>\u68c0\u67e5 mysql-exporter \u5bb9\u5668\u65e5\u5fd7&#xff1a;<\/p>\n<p> kubectl logs &lt;mysql-exporter-pod-name&gt; -c mysql-exporter <\/p>\n<ul>\n<li>\u786e\u4fdd\u6ca1\u6709\u9519\u8bef\u65e5\u5fd7\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u68c0\u67e5 Pod \u72b6\u6001&#xff1a;<\/p>\n<p> kubectl get pods <\/p>\n<ul>\n<li>\u786e\u4fdd mysql-exporter \u5bb9\u5668\u5904\u4e8e Running \u72b6\u6001\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8bbf\u95ee Prometheus Web UI&#xff08;http:\/\/&lt;prometheus-server&gt;:9090&#xff09;&#xff0c;\u67e5\u770b Targets \u9875\u9762&#xff0c;\u786e\u8ba4 MySQL \u76ee\u6807\u5df2\u88ab\u53d1\u73b0\u3002 ![[IMG-5\u3001k8s\u5e73\u53f0&#xff1a;mysql \u76d1\u63a7\u6848\u4f8b-20250317170341907.png]]<\/p>\n<\/li>\n<hr \/>\n<h4 id=\"9-\u751f\u4ea7\u73af\u5883\u5efa\u8bae\">9. \u751f\u4ea7\u73af\u5883\u5efa\u8bae<\/h4>\n<ul>\n<li>\u9ad8\u53ef\u7528\u6027&#xff1a;\u90e8\u7f72\u591a\u4e2a MySQL Exporter \u5b9e\u4f8b&#xff0c;\u5e76\u4f7f\u7528 Kubernetes \u7684 HorizontalPodAutoscaler \u5b9e\u73b0\u81ea\u52a8\u6269\u5c55\u3002<\/li>\n<li>\u76d1\u63a7\u544a\u8b66&#xff1a;\u8bbe\u7f6e MySQL \u5173\u952e\u6307\u6807\u7684\u544a\u8b66\u89c4\u5219&#xff08;\u5982\u8fde\u63a5\u6570\u3001\u6162\u67e5\u8be2\u7b49&#xff09;\u3002<\/li>\n<li>\u8d44\u6e90\u9650\u5236&#xff1a;\u4e3a MySQL Exporter \u8bbe\u7f6e\u8d44\u6e90\u9650\u5236&#xff08;CPU \u548c\u5185\u5b58&#xff09;\u3002<\/li>\n<li>\u65e5\u5fd7\u7ba1\u7406&#xff1a;\u6536\u96c6 MySQL Exporter \u7684\u65e5\u5fd7&#xff0c;\u4fbf\u4e8e\u6392\u67e5\u95ee\u9898\u3002<\/li>\n<\/ul>\n<hr \/>\n<h4 id=\"10-\u793a\u4f8b\u544a\u8b66\u89c4\u5219-mysql-alertsyml\">10. \u793a\u4f8b\u544a\u8b66\u89c4\u5219 (mysql-alerts.yml)<\/h4>\n<p>groups:<br \/>\n  &#8211; name: mysql_alerts<br \/>\n    rules:<br \/>\n      &#8211; alert: MySQLDown<br \/>\n        expr: mysql_up &#061;&#061; 0<br \/>\n        for: 1m<br \/>\n        labels:<br \/>\n          severity: critical<br \/>\n        annotations:<br \/>\n          summary: &#034;MySQL is down&#034;<br \/>\n          description: &#034;MySQL instance {{ $labels.instance }} is down.&#034;<\/p>\n<p>      &#8211; alert: HighMySQLConnections<br \/>\n        expr: mysql_global_status_connections &gt; 1000<br \/>\n        for: 5m<br \/>\n        labels:<br \/>\n          severity: warning<br \/>\n        annotations:<br \/>\n          summary: &#034;High number of MySQL connections&#034;<br \/>\n          description: &#034;MySQL instance {{ $labels.instance }} has more than 1000 connections.&#034;<\/p>\n<p>      &#8211; alert: HighMySQLSlowQueries<br \/>\n        expr: mysql_global_status_slow_queries &gt; 10<br \/>\n        for: 5m<br \/>\n        labels:<br \/>\n          severity: warning<br \/>\n        annotations:<br \/>\n          summary: &#034;High number of slow queries on MySQL&#034;<br \/>\n          description: &#034;MySQL instance {{ $labels.instance }} has more than 10 slow queries.&#034; <\/p>\n<h4 id=\"\u603b\u7ed3\"><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb656\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf7\u6b21\u3002\u914d\u7f6e\u6587\u4ef6\u4f18\u5316\u540e\u7684 Prometheus \u81ea\u52a8\u53d1\u73b0 MySQL \u5b9e\u4f8b\u7684\u5b8c\u6574 YAML \u6587\u4ef6\u3002ConfigMap\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[120,678,371,44],"topic":[],"class_list":["post-38972","post","type-post","status-publish","format-standard","hentry","category-server","tag-kubernetes","tag-prometheus","tag-371","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Prometheus\u5b9e\u6218\u6559\u7a0b\uff1ak8s\u5e73\u53f0-Mysql\u76d1\u63a7\u6848\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/38972.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Prometheus\u5b9e\u6218\u6559\u7a0b\uff1ak8s\u5e73\u53f0-Mysql\u76d1\u63a7\u6848\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb656\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf7\u6b21\u3002\u914d\u7f6e\u6587\u4ef6\u4f18\u5316\u540e\u7684 Prometheus \u81ea\u52a8\u53d1\u73b0 MySQL \u5b9e\u4f8b\u7684\u5b8c\u6574 YAML \u6587\u4ef6\u3002ConfigMap\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/38972.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-21T14:03:31+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/38972.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/38972.html\",\"name\":\"Prometheus\u5b9e\u6218\u6559\u7a0b\uff1ak8s\u5e73\u53f0-Mysql\u76d1\u63a7\u6848\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-05-21T14:03:31+00:00\",\"dateModified\":\"2025-05-21T14:03:31+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/38972.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/38972.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/38972.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Prometheus\u5b9e\u6218\u6559\u7a0b\uff1ak8s\u5e73\u53f0-Mysql\u76d1\u63a7\u6848\u4f8b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Prometheus\u5b9e\u6218\u6559\u7a0b\uff1ak8s\u5e73\u53f0-Mysql\u76d1\u63a7\u6848\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/38972.html","og_locale":"zh_CN","og_type":"article","og_title":"Prometheus\u5b9e\u6218\u6559\u7a0b\uff1ak8s\u5e73\u53f0-Mysql\u76d1\u63a7\u6848\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb656\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf7\u6b21\u3002\u914d\u7f6e\u6587\u4ef6\u4f18\u5316\u540e\u7684 Prometheus \u81ea\u52a8\u53d1\u73b0 MySQL \u5b9e\u4f8b\u7684\u5b8c\u6574 YAML \u6587\u4ef6\u3002ConfigMap\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/38972.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-05-21T14:03:31+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/38972.html","url":"https:\/\/www.wsisp.com\/helps\/38972.html","name":"Prometheus\u5b9e\u6218\u6559\u7a0b\uff1ak8s\u5e73\u53f0-Mysql\u76d1\u63a7\u6848\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-05-21T14:03:31+00:00","dateModified":"2025-05-21T14:03:31+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/38972.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/38972.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/38972.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Prometheus\u5b9e\u6218\u6559\u7a0b\uff1ak8s\u5e73\u53f0-Mysql\u76d1\u63a7\u6848\u4f8b"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/38972","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=38972"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/38972\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=38972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=38972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=38972"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=38972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}