> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol.md).

# Replication Protocol

{% columns %}
{% column %}
{% content-ref url="/pages/YbcMasDBpg8TE8pADefV" %}
[1-Binlog Events](/docs/server/reference/clientserver-protocol/replication-protocol/1-binlog-events.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
This section provides an overview of the various events recorded in the binary log, which are the core units of replication data transmission.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/NcmNc8WI0rarpLpVKK2L" %}
[2-Binlog Event Header](/docs/server/reference/clientserver-protocol/replication-protocol/2-binlog-event-header.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Every binary log event starts with a standardized header containing metadata such as the timestamp, event type, server ID, and event size.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/PVg4ASxsRJ4xFVKe2yNb" %}
[3-Binlog Network Stream](/docs/server/reference/clientserver-protocol/replication-protocol/3-binlog-network-stream.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Describes the continuous packet stream format used to transmit binary log events from the primary server to the replica over the network.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/9UPEIfhZ4L8oBFbEFKfg" %}
[4-Semi-Sync Replication](/docs/server/reference/clientserver-protocol/replication-protocol/4-semi-sync-replication.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Explains the handshake and acknowledgement process for semi-synchronous replication, ensuring data is committed on at least one replica.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/nnsqmhxQhp6NBNw9DYBG" %}
[5-Replica Registration](/docs/server/reference/clientserver-protocol/replication-protocol/5-replica-registration.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Details the initialization phase where a replica connects to the primary, authenticates, sends capabilities, and registers for updates.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/u3d4b1wrbiAeVliD3TfX" %}
[ANNOTATE\_ROWS\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/annotate_rows_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
This event accompanies row-based events to provide the original SQL query text, which is useful for auditing and debugging replication.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/3dr29JjH3UTmxRHjSsBW" %}
[BEGIN\_LOAD\_QUERY\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/begin_load_query_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Used during LOAD DATA INFILE operations, this event marks the beginning of the data load and contains the initial query information.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/HvKfFT2viXClLf2VlKc6" %}
[BINLOG\_CHECKPOINT\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/binlog_checkpoint_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
A marker event indicating a checkpoint in the binary log, used to ensure consistency and safe rotation of log files.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/R4PRCydBzRLz7HSm8ebJ" %}
[COM\_BINLOG\_DUMP](/docs/server/reference/clientserver-protocol/replication-protocol/com_binlog_dump.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
This command is sent by a replica to the primary server to request the start of the binary log event stream from a specific file and position.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/5wKcR95IG4Y0nL8MV9g8" %}
[COM\_REGISTER\_SLAVE](/docs/server/reference/clientserver-protocol/replication-protocol/com_register_slave.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
This command is used by a replica to register its details, such as server ID, hostname, and port, with the primary server.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/X8KN4v1iFV2lx3bE23u1" %}
[EXECUTE\_LOAD\_QUERY\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/execute_load_query_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
This event is used for LOAD DATA INFILE operations, managing the execution phase similar to a QUERY\_EVENT but with extra static fields for file handling.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/truNtZ8tcBThLC3b9uo0" %}
[Fake GTID\_LIST Event](/docs/server/reference/clientserver-protocol/replication-protocol/fake-gtid_list-event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
A synthetic event sent by the master after the initial handshake to inform the replica of its current GTID state, it is not written to the binary log.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/1UoW35tOHMNq7FI4COoa" %}
[Fake ROTATE\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/fake-rotate_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
An artificial event sent to the replica to indicate the name of the binary log file on the master, ensuring the replica knows which file is being read.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/FhxHUCmOdNE7shoHVVS5" %}
[FORMAT\_DESCRIPTION\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/format_description_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
This descriptor event appears at the start of every binary log file, defining the server version, binlog version, and header lengths for all event types.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/7COSjtcMI14QrnMreQyx" %}
[GTID\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/gtid_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
The GTID\_EVENT marks the start of a new transaction event group, associating it with a Global Transaction ID (GTID) and providing commit flags.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/qAr3MwZvTnS8xH9o7BEg" %}
[GTID\_LIST\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/gtid_list_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Logged during binlog rotation or checkpoints, this event lists the GTIDs present in the binary log to help replicas determine their replication state.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/SYmeW4YBz04YYMkgjO07" %}
[HEARTBEAT\_LOG\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/heartbeat_log_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
A heartbeat event sent over the network by the master when there are no binlog events, ensuring the replica knows the connection is still active.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/ajcYfWiEzobyoR3pEhGX" %}
[INTVAR\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/intvar_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
This event records integer values for auto-increment columns or the LAST\_INSERT\_ID function, ensuring that these values are replicated deterministically.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/QTEW9uP5TBXxFeK8kTJh" %}
[QUERY\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/query_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
The QUERY\_EVENT records text-based SQL statements for statement-based replication, capturing the query string and execution context like the default database.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/RMM3qymIvGr2tsDbcsFf" %}
[RAND\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/rand_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
The RAND\_EVENT records the two seed values used for the random number generator, ensuring that calls to the RAND() function produce identical results on replicas.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/GkkjQuQFlPueySC3nbZq" %}
[ROTATE\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/rotate_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
The ROTATE\_EVENT indicates a log rotation, specifying the name of the next binary log file and the position where writing will continue.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/KrOMDyxaVPSLHvmrrqXH" %}
[ROWS\_EVENT\_V1/V2, ROWS\_COMPRESSED\_EVENT\_V1](/docs/server/reference/clientserver-protocol/replication-protocol/rows_event_v1v2-rows_compressed_event_v1.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
These events record row-level changes (WRITE, UPDATE, DELETE) for replication, with versions supporting different column counts and compression.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/PuQ3vWXxpmESsEKlvmsp" %}
[START\_ENCRYPTION\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/start_encryption_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
This event marks the beginning of encrypted data in the binary log, defining the encryption scheme and key version for subsequent events.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/MELXOtpK90gNzghFQL9v" %}
[STOP\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/stop_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
The STOP\_EVENT is written to the binary log when the server shuts down, serving as a marker for a clean stop.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/T5Jtkgr47FBh6rbSf6Jj" %}
[TABLE\_MAP\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/table_map_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
This event provides a mapping between a table ID and its table definition, preceding row events to interpret the row data correctly.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/Gwt2MW1iaqBFDVir1wGZ" %}
[USER\_VAR\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/user_var_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
The USER\_VAR\_EVENT logs the value of a user-defined variable, ensuring that statements using variables replicate consistently.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/kmM4fu5NgS7DDC74JUcM" %}
[XA\_PREPARE\_LOG\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/xa_prepare_log_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
This event records the preparation phase of an XA transaction, storing the XID to support two-phase commit and recovery.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/bbMZ5erJkHzE5UDFqqzG" %}
[XID\_EVENT](/docs/server/reference/clientserver-protocol/replication-protocol/xid_event.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
The XID\_EVENT signifies the commit of a transaction, containing the transaction ID (XID) to ensure atomicity across replication.
{% endcolumn %}
{% endcolumns %}
