mysql administration in amazon rds
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
![Page 1: MySQL administration in Amazon RDS](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/1.jpg)
MySQL administration in
Amazon RDS
PALOMINODB OPERATIONAL EXCELLENCE
FOR DATABASES
Ben Black
www.palominodb.com
![Page 2: MySQL administration in Amazon RDS](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/2.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/3.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/4.jpg)
Create an RDS instance
![Page 5: MySQL administration in Amazon RDS](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/5.jpg)
Create an RDS instance
![Page 6: MySQL administration in Amazon RDS](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/6.jpg)
Create an RDS instance
![Page 7: MySQL administration in Amazon RDS](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/7.jpg)
Security Group setup
![Page 8: MySQL administration in Amazon RDS](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/8.jpg)
Parameter Group Setup
![Page 9: MySQL administration in Amazon RDS](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/9.jpg)
Parameter Group Setup
![Page 10: MySQL administration in Amazon RDS](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/10.jpg)
Parameter Group Setup
![Page 11: MySQL administration in Amazon RDS](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/11.jpg)
Anyone have pointy
clicky rage yet?
![Page 12: MySQL administration in Amazon RDS](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/12.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/13.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/14.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/15.jpg)
Limitations
sync_binlog=1
Broken replication/rebuilding replicas/failover
![Page 16: MySQL administration in Amazon RDS](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/16.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/17.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/18.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/19.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/20.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/21.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/22.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/23.jpg)
RDS vs EC2
![Page 24: MySQL administration in Amazon RDS](https://reader034.vdocument.in/reader034/viewer/2022042513/5558c364d8b42a995d8b4577/html5/thumbnails/24.jpg)
Cost considerations
Instance type
Multi-AZ => 2x
PIOPS
Replicas
Disk size