MySQL administration in Amazon RDS

25
MySQL administration in Amazon RDS PALOMINODB OPERATIONAL EXCELLENCE FOR DATABASES Ben Black www.palominodb.com

description

This is a great session for those new to this this tooll. PalominoDB's Ben Black will cover common tasks in RDS and gotchas for DBA's that are new to RDS.

Transcript of MySQL administration in Amazon RDS

Page 1: MySQL administration in Amazon RDS

MySQL administration in

Amazon RDS

PALOMINODB OPERATIONAL EXCELLENCE

FOR DATABASES

Ben Black

www.palominodb.com

Page 2: MySQL administration in Amazon RDS

What is RDS

"Amazon Relational Database Service is a

web service that makes it easy to set up,

operate, and scale a relational database in

the cloud."

Page 3: MySQL administration in Amazon RDS

Why use RDS

1) Easy to set up

2) Flexibility/Scalability/Pay as you go

3) Easy to create replicas

4) Multiple AZ

5) Easy Admin/backups

Page 4: MySQL administration in Amazon RDS

Create an RDS instance

Page 5: MySQL administration in Amazon RDS

Create an RDS instance

Page 6: MySQL administration in Amazon RDS

Create an RDS instance

Page 7: MySQL administration in Amazon RDS

Security Group setup

Page 8: MySQL administration in Amazon RDS

Parameter Group Setup

Page 9: MySQL administration in Amazon RDS

Parameter Group Setup

Page 10: MySQL administration in Amazon RDS

Parameter Group Setup

Page 11: MySQL administration in Amazon RDS

Anyone have pointy

clicky rage yet?

Page 12: MySQL administration in Amazon RDS

rds-cli Download rds cli tools from amazon, unzip, and create a

symlink

vi /home/bblack/rdscreds

AWSAccessKeyId=<DELETED>

AWSSecretKey=<DELETED>

chmod 600 /home/bblack/rdscreds

Add to .bashrc

export AWS_RDS_HOME=/home/bblack/RDSCli

export AWS_CREDENTIAL_FILE=/home/bblack/rdscreds

Page 13: MySQL administration in Amazon RDS

rds-cli

rds-create-db-instance

rds-create-db-instance-read-replica

rds-modify-db-instance

rds-modify-db-parameter-group

rds-describe-db-instances

rds-reboot-db-instance

Page 14: MySQL administration in Amazon RDS

rds-cli

rds-modify-db-parameter-group dev-pg --

parameters="name=sql_mode,

value='STRICT_TRANS_TABLES',

method=immediate"

"{TrueIfReplica}"

Page 15: MySQL administration in Amazon RDS

Limitations

sync_binlog=1

Broken replication/rebuilding replicas/failover

Page 16: MySQL administration in Amazon RDS

Things to set

log_bin_trust_function_creators

max_connect_errors

slow query logging

sync_binlog

query cache

Page 17: MySQL administration in Amazon RDS

Limitations

Slow Query Logs (blog on how to do it)

http://www.palominodb.com/blog/2011/10/20/exporting-

mysqlslowlog-table-slow-query-log-format

MySQL upgrades

Schema changes

Replication out of RDS

Page 18: MySQL administration in Amazon RDS

Limitations

Forced Maintenance

Changing the size of disk with replicas

How to dump/load data and users

Can't dump mysql schema

--routines

Page 19: MySQL administration in Amazon RDS

Dumping Users

pt-show-grants -OR-

mysql --host=olddatabasehost -BNe "select

concat('\'',user,'\'@\'',host,'\'') from mysql.user where user

not like 'rds%' and user != 'master'" | \

while read uh; do mysql --host=olddatabasehost -BNe

"show grants for $uh" | sed 's/$/;/; s/\\\\/\\/g'; done >

user_grants.sql

http://www.villescorner.com/2012/11/mysqldump-from-

amazon-rds-headaches-of.html

Page 20: MySQL administration in Amazon RDS

Limitations

Single region replicas/Multi-AZ

What happens when an AZ or region goes

down?

"...as if millions of voices suddenly cried out in terror and were suddenly silenced."

Page 21: MySQL administration in Amazon RDS

DDL

No option to alter slave and swap with master

Blocking DDL

OSC tools (no OS access)

show table status like '%blah%';

Lots more on OSC tomorrow (B @ 2pm)

Page 22: MySQL administration in Amazon RDS

DDL

What do you do if you really break replication?

CALL mysql.rds_skip_repl_error;

Recreate replica(s)

one at a time

possible to rename

Page 23: MySQL administration in Amazon RDS

RDS vs EC2

Page 24: MySQL administration in Amazon RDS

Cost considerations

Instance type

Multi-AZ => 2x

PIOPS

Replicas

Disk size

Page 25: MySQL administration in Amazon RDS

Questions

Ben Black

[email protected]

www.palominodb.com