Transaction Log Settings and Requirements
Learn how to prepare MySQL database and supported variants for Oracle GoldenGate, including required binary logging setting and database server variables.
Configuring Logging Properties
Oracle GoldenGate relies on the MySQL binary logs to store the data that it needs to replicate source transactions. The binary logs on the source system must be configured properly before you start Oracle GoldenGate processing.
This section addresses the following binary log startup options and system variables that apply to Oracle GoldenGate for MySQL.
Logging Options | Values | What It Does | Requirement |
---|---|---|---|
binlog_annotate_row_events |
ON , OFF |
System variable that tells the primary server to write these events to the binary log. | Required when using MariaDB as a source database.
|
binlog_expire_logs_seconds |
0 - 4294967295 |
Where supported, this system variable sets the binary log expiration period, in seconds. | Recommended value is: >=86400 |
binlog_format |
ROW, STATEMENT, MIXED |
System variable that sets the binary logging format. |
Required when MySQL is used as source database. If set to
|
binlog retention hours |
1 - 168 |
Where supported, this system variable sets the binary log expiration period, in hours. | Recommended value is: >=24 |
binlog_row_image |
FULL, MINIMAL, NOBLOB |
System variable that sets different levels of column level logging in the binary log. |
Required when MySQL is used as source database.
|
binlog_row_metadata |
FULL, MINIMAL |
System variable that configures the amount of metadata added to the binary log for row-based logging. |
Required when MySQL 8.0 or above is used as source database for DDL support.
|
event_scheduler |
ON, OFF |
System variable that allows creation of Heartbeat update and purge jobs. |
Required if implementing the Oracle GoldenGate Heartbeat functionality.
|
log_bin |
ON, OFF |
System variable that shows the status of binary logging. | Required when MySQL is used as source database. If not already
ON , set by assigning a name, such as
log-bin=binlog. |
log_replica_updates |
ON, OFF |
System variable that logs updates into the secondary server’s own binary log when received from a primary server. |
Required when MySQL is used as source database and is configured to capture from a replica server.
|
server_id |
0 - 4294967295 |
System variable required to be specified when binary logging is enabled. For a replication primary and each replication replica, ensure values are >0 and unique. |
Required when MySQL is used as source database.
|
Verify Database-Level Logging
To verify the database’s current binary logging settings required to support Oracle GoldenGate Capture for the MySQL database, perform the following queries. If settings need to be change, follow the instructions under Enable Database-level Logging
-
Log in to MySQL as the root or assigned database service Administrator account.
[root@srcdbserver ~]$ mysql -uroot -p
-
Issue the following command to determine whether the database is enabled for binary logging. If the result is ON, then database binary log is enabled.
show variables like ‘log_bin’;
-
Issue the following commands to determine whether the database is enabled with the correct binary log settings and
server_id
. Ensure that thebinlog_format
value is set toROW
, thebinlog_row_image
andbinlog_row_metadata
are set toFULL
, and that theserver_id
variable is set to>=1
and are unique for a primary and any replicas.show variables like ‘binlog_%’; show variables like ‘server_id’;
-
Repeat the process to query the variables for the other options listed in the Configuring Logging Properties, based on your requirements, such as DDL support and MariaDB support.
Enable Database-level Logging
Perform the following steps, if necessary, to enable the database binary logging settings required to support Oracle GoldenGate Capture for a MySQL database. Only modify those settings that need to be enabled or changed, based on the results from Verify Database-Level Logging.
-
Edit the MySQL configuration file,
my.cnf
for Linux, ormy.ini
for Windows, to enable system variables that are required to support Oracle GoldenGate capture for MySQL.[root@srcdbserver ~]$ vi /etc/my.cnf
-
To enable the binary log, add an entry to the configuration file, like the following, using a log-bin value of your preference.
log-bin=binlog
-
To set the correct binary logging format and
server_id
variables, set the following:binlog-format=ROW binlog-row-image=FULL #For MySQL 8.0 and above, for DDL support binlog-row-metadata=FULL #Set to value > 0 and <= 4294967295 server-id=1
-
Add additional variables for the other options listed in Configuring Logging Properties, based on your requirements, such as DDL support and MariaDB support.
-
Save and close the file.
-
Restart the database for the settings to take effect.
[root@srcdbserver ~]$ service mysqld restart
-
Check the status of the database service using the following command:
[root@srcdbserver ~]$ service mysqld status
Modifying System Variables for Amazon and Azure MySQL Database Services
To configure Amazon and Azure MySQL databases for Oracle GoldenGate Extract and heartbeat functionality, required changes must be done using the parameter groups, database creation or modification, or server parameter settings, if not already set to the required values. Use the following guidelines to modify these system variables:
-
To enable binary logging in Amazon, you must enable backups of the database, otherwise the
log_bin
variable will report asOFF
and Extract will abend, reporting that it cannot retrieve the list ofbinlog
files.Enable backups at database creation or by modify an existing database to include a backup regiment.
-
For Amazon MySQL databases, set the
binglog_format
variable toROW
, thebinlog_row_image
variable toFULL
, theevent_scheduler
toON
if implementing the Oracle GoldenGate heartbeat functionality, and set thebinlog_row_metadata
variable toFULL
if enabling DDL capture support.Follow the instructions provided by Amazon to create or edit an existing Parameter group in order to make these changes.
https://aws.amazon.com/premiumsupport/knowledge-center/enable-binary-logging-aurora/
-
For Azure MySQL databases, set the
binlog_format
variable toROW
and thebinlog_row_image
variable toFULL
. Follow the instructions provided by Microsoft to modify the server parameter settings for the database instance.https://docs.microsoft.com/en-us/azure/mysql/howto-server-parameters
Ensuring Data Availability
Retain enough binary log data so that if you stop Extract or there is an unplanned outage, Extract can start again from its checkpoints. Extract must have access to the binary log that contains the start of the oldest uncommitted unit of work, and all binary logs thereafter. The recommended retention period is at least 24 hours worth of transaction data, including both active and archived information. You might need to do some testing to determine the best retention time given your data volume and business requirements.
If data that Extract needs during processing was not retained, either in active or backup logs, one of the following corrective actions might be required:
-
Alter Extract to capture from a later point in time for which binary log data is available (and accept possible data loss on the target).
-
Resynchronize the source and target tables, and then start the Oracle GoldenGate environment over again.
-
For MySQL Server, MySQL Heatwave, Azure Database for MySQL, and MariaDB, the variable
binlog_expire_logs_seconds
can be increased to adjust the retention period. -
For Amazon Aurora for MySQL and Amazon RDS for MySQL, the default binary log retention settings are
NULL
, which means, for Aurora the logs are lazily purged and for RDS for MySQL, they are not retained. Use the following procedure to set the parameterbinlog
retention hours. For example:call mysql.rds_set_configuration('binlog retention hours', 24);
Capturing Against a MySQL Replication Replica
You can configure Oracle GoldenGate to capture from a MySQL replication replica.
Typically, the transactions applied at the replica are logged into the relay logs and
not into the replica's binlog
. For the replica to write
transactions that it receives from the primary, into its binlog
,
you must start the replication replica with the log_replica_updates
option as 1
in my.cnf
in conjunction with the
other binary logging parameters for Oracle GoldenGate. After the primary’s
transactions are in the replica’s binlog
, you can set up a regular
Oracle GoldenGate Extract on the replica to begin capture.