MySQL administration in Amazon RDS

Post on 17-May-2015

2.476 views 4 download

Tags:

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

MySQL administration in

Amazon RDS

PALOMINODB OPERATIONAL EXCELLENCE

FOR DATABASES

Ben Black

www.palominodb.com

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."

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

Create an RDS instance

Create an RDS instance

Create an RDS instance

Security Group setup

Parameter Group Setup

Parameter Group Setup

Parameter Group Setup

Anyone have pointy

clicky rage yet?

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

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

rds-cli

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

parameters="name=sql_mode,

value='STRICT_TRANS_TABLES',

method=immediate"

"{TrueIfReplica}"

Limitations

sync_binlog=1

Broken replication/rebuilding replicas/failover

Things to set

log_bin_trust_function_creators

max_connect_errors

slow query logging

sync_binlog

query cache

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

Limitations

Forced Maintenance

Changing the size of disk with replicas

How to dump/load data and users

Can't dump mysql schema

--routines

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

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."

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)

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

RDS vs EC2

Cost considerations

Instance type

Multi-AZ => 2x

PIOPS

Replicas

Disk size

Questions

Ben Black

ben@palominodb.com

www.palominodb.com