首页 > 数据库 >【MySQL 8.0】通过pt-heartbeat监控从库与主库的复制延迟

【MySQL 8.0】通过pt-heartbeat监控从库与主库的复制延迟

时间:2023-08-26 15:35:47浏览次数:44  
标签:主库 8.0 2.87 pt -- 0.00 percona 8.60 root

[root@node01 ~]# wget https://repo.percona.com/yum/percona-release-latest.noarch.rpm
[root@node01 ~]# rpm -ivh percona-release-latest.noarch.rpm
[root@node01 ~]# yum install -y percona-toolkit 
[root@node01 ~]# pt-heartbeat --version
pt-heartbeat 3.5.2

[mysql@node01 ~]$ mysql -uroot -pabcd.1234 -e 'create database percona;'

[mysql@node01 ~]$ pt-heartbeat --user=root --ask-pass --database=percona --create-table --update --daemonize 
Enter password: 

[mysql@node01 ~]$ mysql -uroot -pabcd.1234 -hnode01 -D percona

(root@node01) > select * from heartbeat;
+----------------------------+-----------+------------------+----------+-----------------------+---------------------+
| ts                         | server_id | file             | position | relay_master_log_file | exec_master_log_pos |
+----------------------------+-----------+------------------+----------+-----------------------+---------------------+
| 2023-04-03T22:26:15.004650 |       101 | mysql-bin.000023 |  2033393 | NULL                  |                NULL |
+----------------------------+-----------+------------------+----------+-----------------------+---------------------+
1 row in set (0.00 sec)
[root@node02 ~]# wget https://repo.percona.com/yum/percona-release-latest.noarch.rpm
[root@node02 ~]# rpm -ivh percona-release-latest.noarch.rpm
[root@node02 ~]# yum install -y percona-toolkit 
[root@node02 ~]# pt-heartbeat --version
pt-heartbeat 3.5.2

[mysql@node02 ~]# pt-heartbeat --user=root --ask-pass --database=percona --monitor --daemonize --log=/tmp/slave-lag.log 
Enter password: 

[mysql@node02 ~]$ tail -n 10 /tmp/slave-lag.log 
0.00s [ 27.17s,  8.60s,  2.87s ]
0.00s [ 26.61s,  8.60s,  2.87s ]
0.00s [ 26.05s,  8.60s,  2.87s ]
0.00s [ 25.46s,  8.60s,  2.87s ]
0.00s [ 24.86s,  8.60s,  2.87s ]
0.00s [ 24.24s,  8.60s,  2.87s ]
0.00s [ 23.60s,  8.60s,  2.87s ]
0.00s [ 22.95s,  8.60s,  2.87s ]
0.00s [ 22.28s,  8.60s,  2.87s ]
0.00s [ 21.60s,  8.60s,  2.87s ]

标签:主库,8.0,2.87,pt,--,0.00,percona,8.60,root
From: https://blog.51cto.com/dbprofessional/7244333

相关文章

  • iptables使用方法
    -A(添加-I(插入-D(删除-F(清除所有-L(显示 -P(默认策略举例:iptables-AINPUT-s10.7.226.135iptcp--dport22-jDROP(丢弃iptables-LINPUT(输入  FORWARD(转发 OUTPUT(输出iptables-AINPUT-s192.168.1.10-jACCEPT(同意 iptables-IINPUT2-s192.168.1.1......
  • 【MySQL 8.0】通过pt-table-checksum校验从库与主库的数据一致性
    通过yum安装percona-toolkit[root@node01~]#wgethttps://repo.percona.com/yum/percona-release-latest.noarch.rpm[root@node01~]#rpm-ivhpercona-release-latest.noarch.rpm[root@node01~]#yuminstall-ypercona-toolkit[mysql@node01~]$pt-table-checksum--......
  • 报错ValueError: Can't find 'adapter_config.json'
    前言在做组内2030项目时,我具体做的一个工作是对大模型进行LoRA微调,在整个过程中有许多坑,其中有些值得记录的问题,于是便产生了这篇博客。问题我在得到微调好的模型后,需要对模型进行性能测评。在加载模型时,遇到如下报错ValueError:Can'tfind'adapter_config.json'补充:报错......
  • 【MySQL 8.0】建立安全的网络连接
    (root@node01)>showglobalvariableslike'require_secure_transport';+--------------------------+-------+|Variable_name|Value|+--------------------------+-------+|require_secure_transport|OFF|+----------------------......
  • 【MySQL 8.0】透明数据加密(TDE)
    [mysql@node01~]$vim/etc/my.cnf[mysqld]early-plugin-load=keyring_file.sokeyring_file_data=/usr/local/mysql/data/keyring(root@node01)>selectplugin_name,plugin_statusfrominformation_schema.pluginswhereplugin_namelike'keyring%';......
  • System.Messaging.MessageQueueException: 对消息队列系统的访问被拒绝
    无法启动服务。System.Messaging.MessageQueueException:对消息队列系统的访问被拒绝。使用Windows的消息队列时,窗体界面的应用可以对消息队列进行全部权限的操作,但是编写的Windows服务对消息队列进行操作时有可能会出现此错误提示,在这里提供一种解决方法:首先明确Windows服务程......
  • org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or nu
    "org.apache.ibatis.exceptions.TooManyResultsException:Expectedoneresult(ornull)tobereturnedbyselectOne(),butfound:2"是MyBatis框架中的异常错误信息,表示在使用selectOne()方法执行查询时,期望返回一个结果(或null),但实际上返回了多个结果。selectOne()方......
  • 【MySQL 8.0】在组复制(MGR)的基础上创建InnoDB Cluster
    [root@node04~]#wgethttps://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell-8.0.32-1.el7.x86_64.rpm[root@node04~]#yumlocalinstallmysql-shell-8.0.32-1.el7.x86_64.rpm-y[root@node04~]#mysqlshMySQLJS>\connectroot@node01:3306MySQL......
  • 【MySQL 8.0】密码复杂度验证组件与连接控制插件
    (root@node01)>installcomponent'file://component_validate_password';QueryOK,0rowsaffected(0.08sec)(root@node01)>select*frommysql.component;+--------------+--------------------+------------------------------------+|compo......
  • JavaScript-算术运算符
    概述JavaScript共提供10个算术运算符,用来完成基本的算术运算。加法运算符:x+y减法运算符: x-y乘法运算符: x*y除法运算符:x/y指数运算符:x**y余数运算符:x%y自增运算符:++x 或者 x++自减运算符:--x 或者 x--数值运算符: +x负数值运算符:-x减法、乘法、除法运算法比较单纯......