More RDS DB Parameter & Security Group Setup

How to Configure DB Parameter Group
By Will Mayall
Contents
Backup Database................................................................................................................................... 1
Create DB Parameter Group ........................................................................................................... 2
Edit Parameters................................................................................................................................... 2
Modify The Instance Action ........................................................................................................ 5
Reboot RDS for Parameters to Take Effect ....................................................................... 7
Verify Parameters are set ........................................................................................................... 8
Backup Database
Before making any configuration changes, backup the database.
use mysqldump or the following script:
Either
m0188ussac1:~/werun-import_prod$ ls -ltr ../scripts/back*
-rwx------ 1 wmayal customer 686 Nov
2 16:15 ../scripts/backup_tables.ksh
m0188ussac1:~/werun-import_prod$ more !$
more ../scripts/back*
#!/bin/ksh
#Stolen from Will Mayall 16-Sep-2011
#syntax ./backup_tables.ksh host username password
dstr=`date +'%m.%d.%H_%M'`
export dstr
touch BACKUP_TABLES.ksh
connections=$(mysql -h$1 -u$2 -p$3 -e "use information_schema;select distinct TABLE_SCHEMA from
TABLES where TABLE_SCHEMA not in
('mysql','performance_schema','temp','innodb','information_schema') order by 1;" |grep -v
TABLE_SCHEMA |grep -v TABLE_NAME|awk '{print $1}')
for table_name in $connections
do
mysql -v -e "show binary logs;" > BINARY_LOG_LIST_${dstr}.txt
1
echo "mysqldump $table_name" >> BACKUP_TABLES.ksh
chmod 700 BACKUP_TABLES.ksh
./BACKUP_TABLES.ksh > BACKUP_TABLES_${dstr}.sql
rm BACKUP_TABLES.ksh
done
m0188ussac1:~/werun-import_prod$
Create DB Parameter Group
Go to https://console.aws.amazon.com/rds/ and log in.
Go to section DB Parameter Groups and create a new DB Parameter Group
named 'mysql55-utf8' with settings like following
screenshot.
NOTE: The DB Parameter Group Family: MUST MATCH YOUR DATABASE VERSION.
It defaults to mysql5.1 which is incorrect for our current
installations!
Edit Parameters
After the DB Parameter Group is created, select the parameter group
and click “Edit Parameters.” Set parameters like the following
screenshots (eg. utf8, binary, utf8_general_ci, SET NAMES utf8).
2
Press the Save Changes, then go back to the Edit Parameters, and go to
the Next Page. NOTE: You have to Save Changes for Each Page.
3
Press the Save Changes, then go back to the Edit Parameters, and go to
the Next Page. NOTE: You have to Save Changes for Each Page.
4
Press the Save Changes, and go to the Instance Action Tab.
Modify The Instance Action
Click on the Instance Action Tab and click on Modify.
5
Click on the Parameter Group Tab and choose the New DB Parameter
Group.
6
Click the Yes, Modify Tab. It will take maybe 5 minutes for the
change to take effect. Look at the DB Parameter Group Line on the
main DB Instance page. It will say Pending Reboot on the DB Parameter
Group Line.
Reboot RDS for Parameters to Take Effect
Click on the Instance Action Tab and select Reboot, WHEN THE AGENCY
GIVES YOU THE OK to reboot the database. It will take about 5 minutes
to reboot the RDS database.
7
Verify Parameters are set
Log into mysql:
m0188ussac1:~/werun-import_prod$ ./connect_to_werun-import_prod.ksh
Welcome to the MySQL monitor.
Commands end with ; or \g.
Your MySQL connection id is 5768
Server version: 5.5.25a-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
8
mysql> \s
-------------mysql
Ver 14.14 Distrib 5.1.48, for sun-solaris2.8 (sparc) using
Connection id:
EditLine wrapper
5768
Current database:
Current user:
admin@66.54.56.1
SSL:
Not in use
Current pager:
stdout
Using outfile:
''
Using delimiter:
;
Server version:
5.5.25a-log Source distribution
Protocol version:
10
Connection:
werun.comv7glwbkvy.eu-west-1.rds.amazonaws.com via TCP/IP
Server characterset:
utf8
Db
characterset:
utf8
Client characterset:
utf8
Conn.
utf8
characterset:
TCP port:
3306
Uptime:
6 days 20 hours 26 min 18 sec
Threads: 4 Questions: 278156
Queries per second avg: 0.469
Slow queries: 15
Opens: 41629
Flush tables: 1
--------------
mysql> show global variables like 'char%';
+--------------------------+--------------------------------------------+
| Variable_name
| Value
|
+--------------------------+--------------------------------------------+
| character_set_client
| utf8
|
| character_set_connection | utf8
|
| character_set_database
|
| utf8
9
Open tables: 61
| character_set_filesystem | binary
|
| character_set_results
| utf8
|
| character_set_server
| utf8
|
| character_set_system
| utf8
|
| character_sets_dir
| /rdsdbbin/mysql-5.5.25a.R1/share/charsets/ |
+--------------------------+--------------------------------------------+
8 rows in set (0.18 sec)
mysql> show global variables like 'coll%';
+----------------------+-----------------+
| Variable_name
| Value
|
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database
| utf8_general_ci |
| collation_server
| utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0.16 sec)
mysql>
10