There is a list of tips that can help any DBA to solve commom administration problems on AWS.
Note: some tips only apply to MySQL 5.6.
Kill Process / Connections:
On RDS you don’t have SUPER privileges, so you can’t kill other user process. This can be solved using some procedures with the account user:
- CALL mysql.rds_kill(processID); – Terminates a connection to the MySQL server.
- CALL mysql.rds_kill_query(queryID); – Terminates a query running against the MySQL server.
More tips here.
Replicate from an External Database:
On RDS you don’t have SUPER privileges, so you can’t use the commands “CHANGE MASTER TO”, but you can use some procedures:
- Instead of “CHANGE MASTER TO”, you can use:
CALL mysql.rds_set_external_master (
host_name
, host_port
, replication_user_name
, replication_user_password
, mysql_binary_log_file_name
, mysql_binary_log_file_location
, ssl_encryption
); - CALL mysql.rds_reset_external_master; – Reconfigures a MySQL DB instance to no longer be a Read Replica of an instance of MySQL running external to Amazon RDS.
- CALL mysql.rds_start_replication; – Initiates replication from a MySQL DB instance.
- CALL mysql.rds_stop_replication; – Terminates replication from a MySQL DB instance.
- CALL mysql.rds_skip_repl_error; – Skips and deletes a replication error on a MySQL DB instance.
Handling Replications Errors:
When the Slave_SQL_Running thread stops, you might need to skip some errors. To to this, use the following command:
- CALL mysql.rds_skip_repl_error; – Skips and deletes a replication error on a MySQL DB instance.
Example:
mysql> CALL mysql.rds_skip_repl_error; +-------------------------------------+ | Message | +-------------------------------------+ | Statement in error has been skipped | +-------------------------------------+ 1 row in set (0.02 sec)
+---------------------------+ | Message | +---------------------------+ | Slave is running normally | +---------------------------+ 1 row in set (2.02 sec)
Query OK, 0 rows affected (2.02 sec)
How to Maintance Huge Databases on Amazon RDS:
In some cases you’ll need to change huge tables or do slow maintance jobs, in operations that takes hours to complete. There are some techniques to help doing this, disabling read_only feature on replicas, changing them, and turning them into master databases.
I created an article describing some techniques: Huge database maintenance techniques on Amazon RDS MySQL.
References:
Funcions: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.MySQL.SQLRef.html
Comments