Documentation Home
MySQL 8.4 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 39.8Mb
PDF (A4) - 39.9Mb
Man Pages (TGZ) - 257.9Kb
Man Pages (Zip) - 364.9Kb
Info (Gzip) - 4.0Mb
Info (Zip) - 4.0Mb


MySQL 8.4 Reference Manual  /  ...  /  Monitoring Row-based Replication

19.4.3 监控基于行的复制

使用基于行的复制时,通过Performance Schema工具来监控复制应用程序(SQL)线程的当前进度,可以跟踪操作的处理和完成的工作量。启用这些Performance Schema工具时,events_stages_current表将显示应用程序线程的阶段和进度。关于背景信息,请参见第29.12.5节,“Performance Schema Stage Event Tables”

跟踪所有三个基于行的复制事件类型(写、更新、删除)的进度:

  • 启用三个Performance Schema工具,通过以下命令:

    mysql> UPDATE performance_schema.setup_instruments SET ENABLED = 'YES'
        -> WHERE NAME LIKE 'stage/sql/Applying batch of row changes%';
  • 等待复制应用程序线程处理一些事件,然后检查进度,查看events_stages_current表。例如,获取update事件的进度时:

    mysql> SELECT WORK_COMPLETED, WORK_ESTIMATED FROM performance_schema.events_stages_current
        -> WHERE EVENT_NAME LIKE 'stage/sql/Applying batch of row changes (update)'
  • 如果binlog_rows_query_log_events启用,关于查询的信息将被存储在二进制日志中,并在processlist_info字段中暴露。要查看触发该事件的原始查询:

    mysql> SELECT db, processlist_state, processlist_info FROM performance_schema.threads
        -> WHERE processlist_state LIKE 'stage/sql/Applying batch of row changes%' AND thread_id = N;