Amazon RDS – MySQL DBA Tasks

As with every other database, Amazon RDS MYSQL also needs DBA tasks to fine tune the database and do periodic health checks etc. But as the AWS platform does not allow the shell access to the DB, there are a limited number of DBA tasks that can be performed as compared to the on-premise installation of MySQL. Below is a list of common DBA tasks that can be performed in AWS RDS MySQL database and their descriptions.

Accessing Error Logs

The MySQL error log ( mysql-error.log) file can be viewed by using the Amazon RDS console or by retrieving the log using the Amazon RDS CLI. mysql-error.log is flushed every 5 minutes, and its contents are appended to mysql-error-running.log. The mysql-error-running.log file is then rotated every hour and the hourly files generated during the last 24 hours are retained.

Using RDS Console

Below there are links to two log files described above.

Using CLI

Using CLI the log files are published to CloudWatch Logs as a JSON Object.

aws rds modify-db-instance \
    --db-instance-identifier mydbinstance \
    --cloudwatch-logs-export-configuration '{"EnableLogTypes":["audit","error","general","slowquery"]}' \
    --apply-immediately
   

Killing a Long Running Session or Query

Sometimes the DBA needs to kill a long running session or query which is not giving the result quick enough. This DBA task is done by first finding the process ID of the query and then using a RDS function to kill the query. The below commands are the examples.

# get the ID
Select * from INFORMATION_SCHEMA.PROCESSLIST
#Apply the Kill Function
CALL mysql.rds_kill(processID);

Improve Crash recovery Time

We can improve the recovery time from a crash by setting a DB parameter called innodb_file_per_table. We can find this parameter in the RDS console as shown below.

Next we can Search for the parameter name as shown below.

Amazon RDS sets the default value for innodb_file_per_table parameter to 1, which allows you to drop individual InnoDB tables and reclaim storage used by those tables for the DB instance. This speeds up the recovery time from the crash.

Stop and Reboot DB

Stopping a DB, Rebooting it or creating snapshots etc can be done easily through RDS console as shown in the below diagram.

This Post Has 10 Comments

  1. obsess

    Nice bⅼog here! Aⅼso your site loɑds up fast!

    What web host are you using? Can I get your affiliate link to your host?
    I wish my site loаdeɗ up as quіckly as yours lol

  2. lister

    Hi there! This is ҝind of off topic but Ӏ need some guidance from an eѕtaƅlished blog.

    Is it toսgh to sеt up уour own blog? I’m not very techincal
    but I can figure things out pretty fast. I’m thinking about makіng my own but I’m
    not sure where to begin. Do you haᴠe any tips or sᥙggestions?
    Thanks

  3. chateau

    This is the right ԝebpage for everyone whօ hopes to find out about this topic.
    You undеrstand so much its almost tough to aгgue with you (not that I personally will need to…НaHa).
    You certainly put a new spin on a subjeсt that’s
    been discussed for a long time. Wondeгful stuff, jᥙst gгeat!

  4. jacob

    Ꭼvery weekend i used to go to ѕee this site,
    becаuse i wisһ for enjoyment, since this this sіte conations
    in fact faѕtidious funny information tоo.

  5. velasquez

    You could dеfinitely see yoᥙr skilⅼs within the articⅼe
    you write. The arena hopes fоr even more passionate writers such as you
    who aren’t afraid to say how they beⅼieve. At all times go
    after your heɑrt.

  6. K Z

    Thanks a lot.

  7. K Z

    Thank you.we will do our best.

  8. K Z

    Thank You.

  9. K Z

    Thanks

  10. K Z

    Thanks a lot.

Leave a Reply