Server instances that you want to use for Group Replication must satisfy the following requirements.
InnoDB Storage Engine. Data must be stored in the
InnoDB
transactional storage engine. Transactions are executed optimistically and then, at commit time, are checked for conflicts. If there are conflicts, in order to maintain consistency across the group, some transactions are rolled back. This means that a transactional storage engine is required. Moreover,InnoDB
provides some additional functionality that enables better management and handling of conflicts when operating together with Group Replication. The use of other storage engines, including the temporaryMEMORY
storage engine, might cause errors in Group Replication. Convert any tables in other storage engines to useInnoDB
before using the instance with Group Replication. You can prevent the use of other storage engines by setting thedisabled_storage_engines
system variable on group members, for example:disabled_storage_engines="MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"
Primary Keys. Every table that is to be replicated by the group must have a defined primary key, or primary key equivalent where the equivalent is a non-null unique key. Such keys are required as a unique identifier for every row within a table, enabling the system to determine which transactions conflict by identifying exactly which rows each transaction has modified. Group Replication has its own built-in set of checks for primary keys or primary key equivalents, and does not use the checks carried out by the
sql_require_primary_key
system variable. You may setsql_require_primary_key=ON
for a server instance where Group Replication is running, and you may set theREQUIRE_TABLE_PRIMARY_KEY_CHECK
option of theCHANGE REPLICATION SOURCE TO
statement toON
for a Group Replication channel. However, be aware that you might find some transactions that are permitted under Group Replication's built-in checks are not permitted under the checks carried out when you setsql_require_primary_key=ON
orREQUIRE_TABLE_PRIMARY_KEY_CHECK=ON
.Network Performance. MySQL Group Replication is designed to be deployed in a cluster environment where server instances are very close to each other. The performance and stability of a group can be impacted by both network latency and network bandwidth. Bi-directional communication must be maintained at all times between all group members. If either inbound or outbound communication is blocked for a server instance (for example, by a firewall, or by connectivity issues), the member cannot function in the group, and the group members (including the member with issues) might not be able to report the correct member status for the affected server instance.
You can use a network infrastructure based on IPv4, IPv6, or a mix of the two, for TCP communication between remote Group Replication servers. There is also nothing preventing Group Replication from operating over a virtual private network (VPN).
Where Group Replication server instances are co-located and share a local group communication engine (XCom) instance, a dedicated input channel with lower overhead is used for communication where possible instead of the TCP socket. For certain Group Replication tasks that require communication between remote XCom instances, such as joining a group, the TCP network is still used, so network performance influences the group's performance.
The following options must be configured as shown on server instances that are members of a group.
Unique Server Identifier. Use the
server_id
system variable to configure the server with a unique server ID, as required for all servers in replication topologies. The server ID must be a positive integer between 1 and (232)−1, and it must be different from every other server ID in use by any other server in the replication topology.Binary Log Active. In MySQL 9.0, binary logging is enabled by default. You can optionally specify the names of the binary log files using
--log-bin[=log_file_name]
. Group Replication replicates the binary log's contents, therefore the binary log needs to be on for it to operate. See Section 7.4.4, “The Binary Log”.Replica Updates Logged. Set
log_replica_updates=ON
if it is not already enabled. (In MySQL 9.0, this is the default.) Group members need to log transactions that are received from their donors at joining time and applied through the replication applier, and to log all transactions that they receive and apply from the group. This enables Group Replication to carry out distributed recovery by state transfer from an existing group member's binary log.Binary Log Row Format. Set
binlog_format=ROW
if necessary; in MySQL 9.0, this is the default. Group Replication relies on the row-based replication format to propagate changes consistently among the servers in the group, and extract the necessary information to detect conflicts among transactions that execute concurrently in different servers in the group. The setting forREQUIRE_ROW_FORMAT
is automatically added to Group Replication's channels to enforce the use of row-based replication when the transactions are applied. See Section 19.2.1, “Replication Formats” and Section 19.3.3, “Replication Privilege Checks”.Global Transaction Identifiers On. Set
gtid_mode=ON
andenforce_gtid_consistency=ON
. These settings are not the defaults. GTID-based replication is required for Group Replication, which uses global transaction identifiers to track the transactions that have been committed on every server instance in the group. See Section 19.1.3, “Replication with Global Transaction Identifiers”.Default Table Encryption. Set
default_table_encryption
to the same value on all group members. Default schema and tablespace encryption can be either enabled (ON
) or disabled (OFF
, the default) as long as the setting is the same on all members.Lower Case Table Names. Set
lower_case_table_names
to the same value on all group members. A setting of 1 is correct for the use of theInnoDB
storage engine, which is required for Group Replication. Note that this setting is not the default on all platforms.Multithreaded Appliers. Group Replication members can be configured as multithreaded replicas, enabling transactions to be applied in parallel. All replicas are configured as multithreaded by default. A nonzero value for
replica_parallel_workers
enables the multithreaded applier on the member. The default is 4 parallel applier threads; up to 1024 parallel applier threads can be specified.Setting
replica_parallel_workers=0
disables parallel execution and gives the replica a single applier thread and no coordinator thread. With that setting, thereplica_parallel_type
andreplica_preserve_commit_order
options have no effect and are ignored. If parallel execution is disabled when GTIDs are in use on a replica, the replica actually uses one parallel worker, to take advantage of the method for retrying transactions without accessing the file positions. However, this behavior does not change anything for the user.Detached XA transactions. MySQL 9.0 and later supports detached XA transactions. A detached transaction is one which, once prepared, is no longer connected to the current session. This happens automatically as part of executing
XA PREPARE
. The prepared XA transaction can be committed or rolled back by another connection, and the current session can then initiate another XA transaction or local transaction without waiting for the transaction that was just prepared to complete.When detached XA transaction support is enabled (
xa_detach_on_prepare = ON
) it is possible for any connection to this server to list (usingXA RECOVER
), roll back, or commit any prepared XA transaction. In addition, you cannot use temporary tables within detached XA transactions.You can disable support for detached XA transactions by setting
xa_detach_on_prepare
toOFF
, but this is not recommended. In particular, if this server is being set up as an instance in MySQL group replication, you should leave this variable set to its default value (ON
).See Section 15.3.8.2, “XA Transaction States”, for more information.