k8s prometheus 监控多个MySql -盖完后的新增

【YC的寻路青春】

上一篇已经有点太多了 容许我分两篇 不然有点爆炸

如果盖完之后 要增新的话
1.去资料库增加有process, replication权限的帐号

CREATE USER 'yc'@'%' IDENTIFIED BY 'yc';grant process, replication client on *.* to 'yc'@'%';                  

2.deployment里面的livenessProbe的command增加

nohup mysqld_exporter  --web.listen-address=$podIP:9107 --config.my-cnf=/etc/.90.cnf &
- /bin/sh- '-c'- >-  nohup mysqld_exporter --web.listen-address=$podIP:9105  --config.my-cnf=/etc/.57.cnf & nohup mysqld_exporter  --web.listen-address=$podIP:9106 --config.my-cnf=/etc/.80.cnf  & exit

变成

  nohup mysqld_exporter --web.listen-address=$podIP:9105  --config.my-cnf=/etc/.57.cnf & nohup mysqld_exporter  --web.listen-address=$podIP:9106 --config.my-cnf=/etc/.80.cnf  & nohup mysqld_exporter --web.listen-address=$podIP:9107  --config.my-cnf=/etc/.90.cnf &exit

3.service 多开port号

ports:    - name: YCdata1      protocol: TCP      port: 9104      targetPort: 9104    - name: YCdata2      protocol: TCP      port: 9105      targetPort: 9105    - name: YCdata3      protocol: TCP      port: 9106      targetPort: 9106

->

 ports:    - name: YCdata1      protocol: TCP      port: 9104      targetPort: 9104    - name: YCdata2      protocol: TCP      port: 9105      targetPort: 9105    - name: YCdata3      protocol: TCP      port: 9106      targetPort: 9106    - name: YCdata4      protocol: TCP      port: 9107      targetPort: 9107

4.servicemonitor 改成你喜欢的名字

 endpoints:    - interval: 15s      port: YCdata1      relabelings:        - targetLabel: instance          replacement: YCdata1    - interval: 15s      port: YCdata2      relabelings:        - targetLabel: instance          replacement: YCdata2    - interval: 15s      port: YCdata3      relabelings:        - targetLabel: instance          replacement: YCdata3
  endpoints:   - interval: 15s     port: YCdata1     relabelings:       - targetLabel: instance         replacement: YCdata1   - interval: 15s     port: YCdata2     relabelings:       - targetLabel: instance         replacement: YCdata2   - interval: 15s     port: YCdata3     relabelings:       - targetLabel: instance         replacement: YCdata3   - interval: 15s     port: YCdata4     relabelings:       - targetLabel: instance         replacement: YCdata4      

done.


关于作者: 网站小编

码农网专注IT技术教程资源分享平台,学习资源下载网站,58码农网包含计算机技术、网站程序源码下载、编程技术论坛、互联网资源下载等产品服务,提供原创、优质、完整内容的专业码农交流分享平台。

热门文章