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

珠海动态网站制作推广关键词挖掘爱站网

珠海动态网站制作推广,关键词挖掘爱站网,高端网站建设报价,天津建设网投标网站最近监控 mysql 数据库,用了 pmm-server、pmm-client 发现监控是真的不太好用,还是用回 prometheus 吧。 部署mysqld_exporter k8s 部署最新版本的 mysqld_exporter,支持的数据库版本 MySQL >5.6、MariaDB > 10.3。 先在数据库创建用…

最近监控 mysql 数据库,用了 pmm-server、pmm-client 发现监控是真的不太好用,还是用回 prometheus 吧。

部署mysqld_exporter

k8s 部署最新版本的 mysqld_exporter,支持的数据库版本 MySQL >=5.6、MariaDB >= 10.3。

先在数据库创建用户以及授权

CREATE USER 'exporter'@'%' IDENTIFIED BY 'XXXXXXXX' WITH MAX_USER_CONNECTIONS 3;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'%';
FLUSH PRIVILEGES;
configmap

mysqld_exporter 的配置文件 configmap,cm.yaml

apiVersion: v1
kind: ConfigMap
metadata:name: mysqld-exporter-confignamespace: monitoring
data:exporter.conf: |[client]user = exporterpassword = xxxxxxxx[client.servers]user = exporterpassword = xxxxxxxx
deployment\service

mysqld_exporter 的 deployment 和 service yaml 文件,deploy.yaml

apiVersion: apps/v1
kind: Deployment
metadata:name: mysqld-exporternamespace: monitoringlabels:app: mysqld-exporter
spec:replicas: 1selector:matchLabels:app: mysqld-exportertemplate:metadata:labels:app: mysqld-exporterspec:containers:- name: mysqld-exporterimage: harbor.wenbo/dockerhub/prom/mysqld-exporter:v0.15.1ports:- containerPort: 9104resources:requests:memory: "1Gi"cpu: "0.5"           volumeMounts:- name: config-volumemountPath: /etc/exporter.confsubPath: exporter.confargs:- --config.my-cnf=/etc/exporter.confvolumes:- name: config-volumeconfigMap:name: mysqld-exporter-config---          
apiVersion: v1
kind: Service
metadata:name: mysqld-exporternamespace: monitoringlabels:app: mysqld-exporter
spec:ports:- port: 9104targetPort: 9104protocol: TCPname: httpselector:app: mysqld-exportertype: NodePort

prometheus 配置

在 prometheus 端,你可以按如下方式设置抓取配置

    - job_name: mysqld # To get metrics about the mysql exporter’s targetsparams:# Not required. Will match value to child in config file. Default value is `client`.auth_module: [client.servers]static_configs:- targets:# All mysql hostnames or unix sockets to monitor.- server1:3306- unix:///run/mysqld/mysqld.socklabels:mysql: alpha-master-72- targets:- server2:3306labels:mysql: alpha-slave1relabel_configs:- source_labels: [__address__]target_label: __param_target- source_labels: [__param_target]target_label: instance- target_label: __address__# The mysqld_exporter host:portreplacement: mysqld-exporter.monitoring.svc.cluster.local:9104

配置告警规则

这里用的是 kube-prometheus。配置了 最大连接数、mysql、io thread、sql thread状态等告警规则。mysqld-exporter-prometheusrule.yaml

apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:#labels:#prometheus: k8s#role: alert-rulesname: prometheusrule-mysqld-exporter-alertrulesnamespace: monitoring
spec:groups:- name: mysqld-statusrules:- alert: MySQLMaxConnectionsexpr: (mysql_global_status_threads_connected / mysql_global_variables_max_connections) * 100 > 90for: 1mlabels:webhook: 'mysql'name: opsseverity: warningannotations:summary: "MySQL 最大连接数达到了 90%"description: '实例 {{$labels.instance}},mysql: {{$labels.mysql}},(目前使用:{{ printf "%0.2f" $value}}%)'- alert: MySQLSlaveIOThreadDownexpr: mysql_slave_status_slave_io_running != 1for: 1mlabels:webhook: "mysql"name: opsseverity: warningannotations:summary: "MySQL Slave I/O 线程停止"description: '实例 {{$labels.instance }},mysql: {{$labels.mysql}},I/O 线程已经停止运行.'- alert: MySQLSlaveSQLThreadDownexpr: mysql_slave_status_slave_sql_running != 1for: 1mlabels:webhook: 'mysql'severity: warningname: opsannotations:summary: "MySQL Slave SQL 线程停止"description: "实例 {{$labels.instance }},mysql: {{$labels.mysql}},SQL 线程已经停止运行."- alert: MySQLDownexpr: mysql_up != 1for: 1mlabels:webhook: 'mysql'severity: warningname: opsannotations:summary: "mysql down"description: "实例 {{$labels.instance }}, mysql: {{$labels.mysql}} down。"- alert: mysqld-exporter-statusexpr: up{job="mysqld"} == 0for: 1mlabels:webhook: 'mysql'severity: warningname: opsannotations:summary: "metrics down"description: "实例 {{$labels.instance }},mysql: {{$labels.mysql}} 数据源异常。"

http://www.fp688.cn/news/143617.html

相关文章:

  • 百度推广视频seo优化策略
  • 做网站编程语言今天的国际新闻
  • 做彩票的网站互联网推广销售
  • 阿里云电影网站建设教程全网推广成功再收费
  • 建材网站建设方案seo的特点是什么
  • 怎么把做的网页放入网站湖北搜索引擎优化
  • 浪起网站建设nba常规赛
  • 韩国男女直接做视频网站sem优化
  • 响应式网站设计优化营商环境工作总结
  • wordpress google font 360沙坪坝区优化关键词软件
  • 多米诺网站建设服务seo关键词优化推广
  • 如皋做网站公司免费发布产品的平台
  • 搭建自己的博客网站什么是seo优化?
  • 济南能源建设网站成都seo优化公司
  • 内地网站用香港服务器seo网站诊断报告
  • 河南网站关键词优化代理网址最新连接查询
  • 17zwd一起做网站广州网站建设的推广渠道
  • erp企业管理系统平台谷歌seo服务商
  • 厦门网站怎么做北京百度推广seo
  • 做公司标志用哪个网站全球搜索引擎入口
  • 英文网站建设580seo推广公司哪家好
  • 西八里庄网站建设网站优化seo是什么意思
  • 厚街微网站建设网站创建
  • 企业网站建设小技巧有哪些近期重大新闻
  • 做博客网站的空间容量需要多少环球军事网
  • 杭州企业名录大全seo关键词排名优化软件
  • html做网站心得seo综合查询什么意思
  • 上海网站建设 浦东爱站网长尾关键词
  • 做网站的品牌公司有哪些搜索推广公司
  • 网站更换服务器 备案湖南好搜公司seo