Got my SCJP-6 Certificate and Card

Amazon Elastic Block Store (EBS) is the persistent storage which can be attached to the AMI instance. Data can be safely placed and accessed independent of the life of the instance. There are plenty of benefits using EBS for MySQL. For detailed explanation click here.

Following steps describes how to use MySQL on EBS volume with OpenSolaris based AMI.
Click here for ec2-create-volume API help.
Click here for more details on this AMI.
In the above command -d option specifies the device number. In OpenSolaris devices are named from 0 to 23. Device number 0 and 1 are used for ephemeral storage. Therefore, we can use the devices starting from 2 until 23.
Click here for ec2-attach-volume API help.
Click here for ec2-describe-volumes API help.
Once the instance is up and running, login into the instance using ssh with your key-pair.
To verify new EBS volume attached, execute the format command and press Control + C to come out.
AVAILABLE DISK SELECTIONS:
0. c3d0 <DEFAULT cyl 1274 alt 0 hd 255 sec 63>
/xpvd/xdf@0
1. c3d1 <DEFAULT cyl 19464 alt 0 hd 255 sec 63>
/xpvd/xdf@1
2. c3d2 <DEFAULT cyl 1305 alt 0 hd 255 sec 63>
/xpvd/xdf@2
Specify disk (enter its number): ^C
root@domU-12-31-39-03-21-E4:~#
Create a ZFS storage pool on the EBS volume.
NAME STATE READ WRITE CKSUM
ebsmysql ONLINE 0 0 0
c3d2 ONLINE 0 0 0
errors: No known data errors
root@domU-12-31-39-03-21-E4:~#
Move MySQL on ZFS storage pool based on EBS
Make sure MySQL service is disabled.
If MySQL service is running make sure to disable it using svcadm disable svc:/application/mysql:default
Move MySQL installation directory to /ebsmysql
Create a soft link to /ebsmysql/mysql/ under /usr/local with the name ‘mysql’
Enable MySQL service
Test MySQL
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| sbtest |
| test |
+——————–+
4 rows in set (0.01 sec)
mysql>
Import the pool
NAME STATE READ WRITE CKSUM
ebsmysql ONLINE 0 0 0
c3d2 ONLINE 0 0 0
c3d3 ONLINE 0 0 0
errors: No known data errors
root@domU-12-31-39-03-21-E4:~#
MySQL on ZFS:
http://dev.mysql.com/tech-resources/articles/mysql-zfs.html
EBS With OpenSolaris AMI:
http://blogs.sun.com/ec2/entry/ebs_is_supported_on_opensolaris
Amazon EBS, OpenSolaris, and ZFS Guide to Getting Started
http://blogs.sun.com/ec2/resource/OpenSolaris-ZFS-EBS-v1.3.pdf
SSH tunnel basically does the port forwarding via secure ssh service.
Let’s start with launching a latest hardened AMP stack AMI (ami-e0b05389) instance.
Once the instnace is up and running, open the terminal client and connect to the instance using ssh.
Edit the /etc/ssh/sshd_config file and set AllowTcpForwarding to yes
AllowTcpForwarding yes
Restart ssh service
svcadm restart svc:/network/ssh:default
Comment out skip-networking from /etc/mysql/my.cnf and save the file
#skip-networking
Restart MySQL service
svcadm restart svc:/application/database/mysql:version_51
exit the ssh connection and recreate ssh connection using following command.
ssh -i <keypair> -L 3307:localhost:3306 root@ec2-xxx-xxx-xxx-xx.compute-1.amazonaws.com
Keep the terminal opened, and start MySQL Query Browser / MySQL administrator from your local machine. and connect to the MySQL server on remote EC2 instance via the port 3307, as shown in the following sanpshots.


When done close the ssh connection and it should close the ssh tunnel.