How to run MySQL in AWS with Zadara Storage

This article provides step by step instructions on how to run a MySQL instance with Zadara Storage at AWS
It assumes a Zadara account and a VPSA have already been created.

If you need to create a Zadara account, please visit the link below:

 


https://www.zadarastorage.com/how-to-create-a-zadara-cloud-block-storage-at-amazon-aws-ec2/

Once the Zadara account and VPSA are created, it is time to create a MySQL environment.

Launch a MySQL instance from the AWS market place

  • Login into  AWS cloud console
  • Go to the AWS market place and find the AMI with pre installed MySQL from Turnkey Linux


https://aws.amazon.com/marketplace/pp/B007I8JCUG/ref=brs_res_product_title?ie=UTF8&sr=0-15&qid=1353434841365

  • Click Continue and click Accept Terms
  • Click Launch with EC2 Console tab
  • choose the AMI in US East can click launch with EC2 console
  • you will see the Request Instances Wizard, click continue to choose the AMI
  • At Intance Details, choose the size of the instance and the VPC and subnet
  • Click continue until you reach the “Create Key Pair”. Choose the right key pair
  • Click continue and choose your security group
  • Review the data and click Launch

Mount VPSA volumes to a MySQL instance:

  • Connect to your instance via ssh (if needed assign elastic IP to connect from outside the cloud)
  • update your version #apt-get update
  • Install iscsi initiator #apt-get install open-iscsi
  • Restart iscsi service #  /etc/init.d/open-iscsi restart                                 
  • Check the IQN of the initiator #cat /etc/iscsi/initiatorname.iscsi

       InitiatorName=iqn.1993-08.org.debian:01:977ad2e6e3d

  • At this point, iSCSI initiator is installed. Next, in order to attach VPSA volumes, you need to use iscsiadm to discover the target and add the CHAP Auth.
  • Go to the VPSA GUI/ Servers and click Connect
  • Select Linux and iSCSI (you will see the instructions you need to run on the VM to connect to VPSA)
  • Go back to the MySQL server. Copy/paste the wget command, and the chmod and the vpsa_linux commands
  • At this point, if you hit in the VPSA GUI Servers /Refresh, you should see the new linux server listed
  • Go to VPSA GUI/Volumes. Create a new volume and attach it to the MySQL server
  • On the MySQL server, you should see the new device by typing #ls -l /dev/disk/by-path
  • Create a file system: #mkfs /dev/sda
  • Create a directory for data: #mkdir /mnt/data
  • Mount the new file system: #mount /dev/sda /mnt/data

Configure MySQL to point to VPSA volume

  • Stop my sql service      # /etc/init.d/mysql stop
  • Edit /etc/mysql/my.cnf file and look for the entry for “datadir”, and change the path (which should be “/var/lib/mysql”) to the new data directory (/mnt/data).
  • restart mysql       # /etc/init.d/mysql restart

Share This Post

More To Explore