I have a production server whose MYSQL may not be backed up. The instance in question has an EBS backed root device (/dev/sda1), which is persistently storing files. It's not clear to me whether it is naturally storing my MYSQL data and binary log files persistently.
Should it do so if it's mounted at root? I would think so.
Should I instead attach and mount another volume and then point the MYSQL server at the new location?
My commands look like the following (plus locking the MYSQL table while creating the snapshot)
sudo mkdir /vol/etc /vol/lib /vol/log
sudo mv /etc/mysql /vol/etc/
sudo mv /var/lib/mysql /vol/lib/
sudo mv /var/log/mysql /vol/log/
sudo mkdir /etc/mysql
sudo mkdir /var/lib/mysql
sudo mkdir /var/log/mysql
echo "/vol/etc/mysql /etc/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /etc/mysql
echo "/vol/lib/mysql /var/lib/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /var/lib/mysql
echo "/vol/log/mysql /var/log/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /var/log/mysql
I am no sys admin expert and I don't want to screw up my existing database. Is there any risk here? Should I even bother with an additional device here or just stick with the built in root device?
I moved the /etc/mysql and /var/lib/mysql directories to my EBS and created symlinks in their previous locations.
That way I didn't have to modify configuration files or worry about something not finding the files.
The reason I also moved /etc/mysql was so that the configuration files and maintenance script would not be lost if I attached the EBS to another instance.
As for a backup of that data, it would be best to create another instance and create a master/master configuration so you also get the benefits of failover.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With