Amazon Relational Database Service
User Guide (API Version 2014-10-31)

mysql.rds_set_configuration

Specifies the number of hours to retain binary logs or the number of seconds to delay replication.

Syntax

CALL mysql.rds_set_configuration(name,value);

Parameters

name

The name of the configuration parameter to set.

value

The value of the configuration parameter.

Usage Notes

The mysql.rds_set_configuration stored procedure is available in these versions of Amazon RDS MySQL:

  • MySQL 5.6

  • MySQL 5.7

  • MySQL 8.0

The mysql.rds_set_configuration procedure supports the following configuration parameters:

binlog retention hours

The binlog retention hours parameter is used to specify the number of hours to retain binary log files. Amazon RDS normally purges a binary log as soon as possible, but the binary log might still be required for replication with a MySQL database external to Amazon RDS. The default value of binlog retention hours is NULL (do not retain binary logs).

To specify the number of hours for Amazon RDS to retain binary logs on a DB instance, use the mysql.rds_set_configuration stored procedure and specify a period with enough time for replication to occur, as shown in the following example.

call mysql.rds_set_configuration('binlog retention hours', 24);

For MySQL DB instances, the maximum binlog retention hours value is 168 (7 days).

After you set the retention period, monitor storage usage for the DB instance to make sure that the retained binary logs don't take up too much storage.

target delay

Use the target delay parameter to specify the number of seconds to delay replication from the master to the Read Replica. The specified delay applies to new replicas created from the current DB instance. Amazon RDS normally replicates changes as soon as possible, but some environments might want to delay replication. For example, when replication is delayed, you can roll forward a delayed Read Replica to the time just before a disaster. If a table is dropped accidentally, you can use delayed replication to recover it quickly. The default value of target delay is 0 (don't delay replication).

For disaster recovery, you can use this configuration parameter with the mysql.rds_start_replication_until stored procedure or the mysql.rds_start_replication_until_gtid stored procedure. To roll forward changes to a delayed Read Replica to the time just before a disaster, you can run the mysql.rds_set_configuration procedure with this parameter set. After the mysql.rds_start_replication_until or mysql.rds_start_replication_until_gtid procedure stops replication, you can promote the Read Replica to be the new master DB instance by using the instructions in Promoting a Read Replica to Be a Standalone DB Instance.

To use the mysql.rds_rds_start_replication_until_gtid procedure, GTID-based replication must be enabled. To skip a specific GTID-based transaction that is known to cause disaster, you can use the mysql.rds_skip_transaction_with_gtid stored procedure. For more information about working with GTID-based replication, see Using GTID-Based Replication for Amazon RDS MySQL.

To specify the number of seconds for Amazon RDS to delay replication to a Read Replica, use the mysql.rds_set_configuration stored procedure and specify the number of seconds to delay replication. The following example specifies that replication is delayed by at least one hour (3,600 seconds).

call mysql.rds_set_configuration('target delay', 3600);

The limit for the target delay parameter is one day (86400 seconds).

Note

The target delay parameter is only supported for Amazon RDS MySQL.

The target delay parameter is not supported for Amazon RDS MySQL version 8.0.

On this page: