- 29.12.11.1 binary_log_transaction_compression_stats 表29.12.11.1 The binary_log_transaction_compression_stats Table
- 29.12.11.2 replication_applier_configuration 表29.12.11.2 The replication_applier_configuration Table
- 29.12.11.3 replication_applier_filters 表29.12.11.3 The replication_applier_filters Table
- 29.12.11.4 replication_applier_global_filters 表29.12.11.4 The replication_applier_global_filters Table
- 29.12.11.5 replication_applier_status 表29.12.11.5 The replication_applier_status Table
- 29.12.11.6 replication_applier_status_by_coordinator 表29.12.11.6 The replication_applier_status_by_coordinator Table
- 29.12.11.7 replication_applier_status_by_worker 表29.12.11.7 The replication_applier_status_by_worker Table
- 29.12.11.8 replication_asynchronous_connection_failover 表29.12.11.8 The replication_asynchronous_connection_failover Table
- 29.12.11.9 replication_asynchronous_connection_failover_managed 表29.12.11.9 The replication_asynchronous_connection_failover_managed Table
- 29.12.11.10 replication_group_communication_information 表29.12.11.10 The replication_group_communication_information Table
- 29.12.11.11 replication_connection_configuration 表29.12.11.11 The replication_connection_configuration Table
- 29.12.11.12 replication_group_configuration_version 表29.12.11.12 The replication_group_configuration_version Table
- 29.12.11.13 replication_connection_status 表29.12.11.13 The replication_connection_status Table
- 29.12.11.14 replication_group_member_actions 表29.12.11.14 The replication_group_member_actions Table
- 29.12.11.15 replication_group_member_stats 表29.12.11.15 The replication_group_member_stats Table
- 29.12.11.16 replication_group_members 表29.12.11.16 The replication_group_members Table
性能模式提供了显示复制信息的表。这类似于使用 SHOW
REPLICA STATUS 语句可获得的信息,但以表格形式表示更易于访问,并且具有可用性优势:The Performance Schema provides tables that expose replication
information. This is similar to the information available from
the SHOW
REPLICA STATUS statement, but representation in table
form is more accessible and has usability benefits:
SHOW REPLICA STATUS的输出对于直观检查很有用,但对程序化使用并不太适合。相比之下,使用性能模式表,可以通过通用的SELECT查询搜索副本状态信息,包括复杂的WHERE条件、连接等。SHOW REPLICA STATUSoutput is useful for visual inspection, but not so much for programmatic use. By contrast, using the Performance Schema tables, information about replica status can be searched using generalSELECTqueries, including complexWHEREconditions, joins, and so forth.查询结果可以保存到表中以便进一步分析,或者赋值给变量,从而在存储过程中使用。Query results can be saved in tables for further analysis, or assigned to variables and thus used in stored procedures.
复制表提供了更好的诊断信息。对于多线程从库操作,
SHOW REPLICA STATUS使用Last_SQL_Errno和Last_SQL_Error字段报告所有协调器和工作线程错误,因此只能看到这些错误的最新信息,可能会丢失信息。复制表按线程存储错误信息,不会丢失数据。The replication tables provide better diagnostic information. For multithreaded replica operation,SHOW REPLICA STATUSreports all coordinator and worker thread errors using theLast_SQL_ErrnoandLast_SQL_Errorfields, so only the most recent of those errors is visible and information can be lost. The replication tables store errors on a per-thread basis without loss of information.最后看到的事务可以在复制表中按每个工作线程查看。这是
SHOW REPLICA STATUS无法提供的信息。The last seen transaction is visible in the replication tables on a per-worker basis. This is information not available fromSHOW REPLICA STATUS.熟悉 Performance Schema 接口的开发人员可以通过向表中添加行来扩展复制表,以提供额外的信息。Developers familiar with the Performance Schema interface can extend the replication tables to provide additional information by adding rows to the tables.
复制表说明Replication Table Descriptions
Performance Schema 提供以下与复制相关的表:The Performance Schema provides the following replication-related tables:
包含关于副本连接到源的信息的表:Tables that contain information about the connection of the replica to the source:
replication_connection_configuration:连接到源的配置参数replication_connection_configuration: Configuration parameters for connecting to the sourcereplication_connection_status:连接到源的当前状态replication_connection_status: Current status of the connection to the sourcereplication_asynchronous_connection_failover:异步连接故障转移机制的源列表replication_asynchronous_connection_failover: Source lists for the asynchronous connection failover mechanism
包含关于事务应用器的一般信息(非线程特定)的表:Tables that contain general (not thread-specific) information about the transaction applier:
replication_applier_configuration:副本上事务应用器的配置参数。replication_applier_configuration: Configuration parameters for the transaction applier on the replica.replication_applier_status:副本上事务应用程序的当前状态。replication_applier_status: Current status of the transaction applier on the replica.
包含有关负责应用从源接收的事务的特定线程信息的表:Tables that contain information about specific threads responsible for applying transactions received from the source:
replication_applier_status_by_coordinator:协调线程的状态(如果副本是多线程的,否则为空)。replication_applier_status_by_coordinator: Status of the coordinator thread (empty unless the replica is multithreaded).replication_applier_status_by_worker:如果副本是多线程的,显示应用线程或工作线程的状态。replication_applier_status_by_worker: Status of the applier thread or worker threads if the replica is multithreaded.
包含有关基于通道的复制过滤器信息的表:Tables that contain information about channel based replication filters:
replication_applier_filters:提供有关在特定复制通道上配置的复制过滤器的信息。replication_applier_filters: Provides information about the replication filters configured on specific replication channels.replication_applier_global_filters:提供关于全局复制过滤器的信息,这些过滤器适用于所有复制通道。replication_applier_global_filters: Provides information about global replication filters, which apply to all replication channels.
包含关于组复制成员信息的表:Tables that contain information about Group Replication members:
replication_group_members:提供组成员的网络和状态信息。replication_group_members: Provides network and status information for group members.replication_group_member_stats:提供有关组成员及其参与事务的统计信息。replication_group_member_stats: Provides statistical information about group members and transactions in which they participate.
有关更多信息,请参见 第 20.4 节,“监控组复制”。For more information see Section 20.4, “Monitoring Group Replication”.
以下 Performance Schema 复制表在禁用 Performance Schema 时仍会继续填充:The following Performance Schema replication tables continue to be populated when the Performance Schema is disabled:
例外情况是复制表中的本地时间信息(事务的开始和结束时间戳):replication_connection_status、replication_applier_status_by_coordinator 和 replication_applier_status_by_worker。当性能模式被禁用时,这些信息不会被收集。The exception is local timing information (start and end
timestamps for transactions) in the replication tables
replication_connection_status,
replication_applier_status_by_coordinator,
and
replication_applier_status_by_worker.
This information is not collected when the Performance Schema is
disabled.
以下各节将更详细地描述每个复制表,包括由 SHOW
REPLICA STATUS 生成的列与复制表中出现相同信息的列之间的对应关系。The following sections describe each replication table in more
detail, including the correspondence between the columns
produced by
SHOW
REPLICA STATUS and the replication table columns in
which the same information appears.
本复制表介绍的其余部分描述了 Performance Schema 如何填充这些表,以及 SHOW
REPLICA STATUS 中哪些字段未在表中表示。The remainder of this introduction to the replication tables
describes how the Performance Schema populates them and which
fields from
SHOW
REPLICA STATUS are not represented in the tables.
复制表生命周期Replication Table Life Cycle
Performance Schema 按如下方式填充复制表:The Performance Schema populates the replication tables as follows:
在执行
CHANGE REPLICATION SOURCE TO之前,表是空的。Prior to execution ofCHANGE REPLICATION SOURCE TO, the tables are empty.在
CHANGE REPLICATION SOURCE TO之后,配置参数可以在表中看到。此时,没有活动的复制线程,因此THREAD_ID列为NULL,SERVICE_STATE列的值为OFF。AfterCHANGE REPLICATION SOURCE TO, the configuration parameters can be seen in the tables. At this time, there are no active replication threads, so theTHREAD_IDcolumns areNULLand theSERVICE_STATEcolumns have a value ofOFF.After
START REPLICA, non-nullTHREAD_IDvalues can be seen. Threads that are idle or active have aSERVICE_STATE删除表中名为ON. The thread that connects to the source has a value ofCONNECTINGwhile it establishes the connection, andONthereafter as long as the connection lasts.AfterSTART REPLICA, non-nullTHREAD_IDvalues can be seen. Threads that are idle or active have aSERVICE_STATEvalue ofON. The thread that connects to the source has a value ofCONNECTINGwhile it establishes the connection, andONthereafter as long as the connection lasts.在
STOP REPLICA之后,THREAD_ID列变为NULL,不再存在的线程的SERVICE_STATE列值为OFF。AfterSTOP REPLICA, theTHREAD_IDcolumns becomeNULLand theSERVICE_STATEcolumns for threads that no longer exist have a value ofOFF.在执行
STOP REPLICA或线程因错误停止后,表格会被保留。The tables are preserved afterSTOP REPLICAor threads stopping due to an error.replication_applier_status_by_worker表仅在副本以多线程模式运行时非空。也就是说,如果replica_parallel_workers系统变量大于 0,则在执行START REPLICA时,该表会被填充,行数显示工作线程的数量。Thereplication_applier_status_by_workertable is nonempty only when the replica is operating in multithreaded mode. That is, if thereplica_parallel_workerssystem variable is greater than 0, this table is populated whenSTART REPLICAis executed, and the number of rows shows the number of workers.
复制状态信息在复制表中不存在Replica Status Information Not In the Replication Tables
性能模式复制表中的信息与通过SHOW
REPLICA STATUS 获取的信息略有不同,因为这些表面向全局事务标识符(GTID)使用,而不是文件名和位置,并且它们表示的是服务器 UUID 值,而不是服务器 ID 值。由于这些差异,一些SHOW
REPLICA STATUS列在性能模式复制表中未保留,或者以不同的方式表示:The information in the Performance Schema replication tables
differs somewhat from the information available from
SHOW
REPLICA STATUS because the tables are oriented toward
use of global transaction identifiers (GTIDs), not file names
and positions, and they represent server UUID values, not server
ID values. Due to these differences, several
SHOW
REPLICA STATUS columns are not preserved in the
Performance Schema replication tables, or are represented a
different way:
以下字段涉及文件名和位置,未被保留:The following fields refer to file names and positions and are not preserved:
Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Exec_Master_Log_Pos Until_Condition Until_Log_File Until_Log_Pos
Master_Info_File字段不会被保留。它指的是用于副本源元数据存储库的master.info文件,该文件已被用于存储库的崩溃安全表所取代。TheMaster_Info_Filefield is not preserved. It refers to themaster.infofile used for the replica's source metadata repository, which has been superseded by the use of crash-safe tables for the repository.以下字段基于
server_id,而非server_uuid,且不会被保留:The following fields are based onserver_id, notserver_uuid, and are not preserved:Master_Server_Id Replicate_Ignore_Server_Ids
Skip_Counter字段基于事件计数,而非 GTID,并且不会被保留。TheSkip_Counterfield is based on event counts, not GTIDs, and is not preserved.这些错误字段是
Last_SQL_Errno和Last_SQL_Error的别名,因此不会被保留:These error fields are aliases forLast_SQL_ErrnoandLast_SQL_Error, so they are not preserved:Last_Errno Last_Error
在性能模式(Performance Schema)中,此错误信息可以在
replication_applier_status_by_worker表的LAST_ERROR_NUMBER和LAST_ERROR_MESSAGE列中找到(如果副本是多线程的,也可以在replication_applier_status_by_coordinator中找到)。这些表提供的每线程错误信息比Last_Errno和Last_Error提供的更具体。In the Performance Schema, this error information is available in theLAST_ERROR_NUMBERandLAST_ERROR_MESSAGEcolumns of thereplication_applier_status_by_workertable (andreplication_applier_status_by_coordinatorif the replica is multithreaded). Those tables provide more specific per-thread error information than is available fromLast_ErrnoandLast_Error.提供关于命令行过滤选项信息的字段不会被保留:Fields that provide information about command-line filtering options is not preserved:
Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table
Replica_IO_State和Replica_SQL_Running_State字段不会被保留。如果需要,可以通过使用适当复制表的THREAD_ID列,并将其与INFORMATION_SCHEMAPROCESSLIST表中的ID列进行连接,从后者表中选择STATE列来获取这些值。TheReplica_IO_StateandReplica_SQL_Running_Statefields are not preserved. If needed, these values can be obtained from the process list by using theTHREAD_IDcolumn of the appropriate replication table and joining it with theIDcolumn in theINFORMATION_SCHEMAPROCESSLISTtable to select theSTATEcolumn of the latter table.Executed_Gtid_Set字段可能显示大量文本的数据集。相反,Performance Schema 表显示的是复制正在应用的事务的 GTID。或者,可以从gtid_executed系统变量的值中获取已执行 GTID 的集合。TheExecuted_Gtid_Setfield can show a large set with a great deal of text. Instead, the Performance Schema tables show GTIDs of transactions that are currently being applied by the replica. Alternatively, the set of executed GTIDs can be obtained from the value of thegtid_executedsystem variable.Seconds_Behind_Master和Relay_Log_Space字段处于待定状态,且不会被保留。TheSeconds_Behind_MasterandRelay_Log_Spacefields are in to-be-decided status and are not preserved.
复制通道Replication Channels
复制性能模式表的第一列是CHANNEL_NAME。这使得表可以按复制通道查看。在非多源复制设置中,只有一个默认复制通道。当您在副本上使用多个复制通道时,可以按复制通道过滤表,以监控特定的复制通道。有关更多信息,请参见第 19.2.2 节,“复制通道”和第 19.1.5.8 节,“多源复制监控”。The first column of the replication Performance Schema tables is
CHANNEL_NAME. This enables the tables to be
viewed per replication channel. In a non-multisource replication
setup there is a single default replication channel. When you
are using multiple replication channels on a replica, you can
filter the tables per replication channel to monitor a specific
replication channel. See Section 19.2.2, “Replication Channels”
and Section 19.1.5.8, “Monitoring Multi-Source Replication” for
more information.