Connect with me
All websites available on the internet are vulnerable to hacking attempts, DDOS attack, Data loss, This could happen to WordPress websites as well.
WordPress has core files, the wp-content folder where the theme, plugin and the user uploaded post media are available, Configuration files which has your database configuration etc and the database contain every post, every comment and every link you have on your blog.
If any of the core files, the configuration is corrupted or lost we can rebuild it, but if your wp-content and your database get erased or corrupted, you stand to lose everything on your website. There are many reasons why this could happen. With a proper backup of your WordPress database and files, you can quickly restore things back to normal.
Using plugins or scripts admin can backup the WordPress site, but if you have a large site and multiple users are using it, this way can drain the server resources leaving you with a slow website. And also transferring of large backup files could result in unfinished uploads or corrupt backups
Snapshot based approach
If you are hosting your WordPress in AWS, Nimesa can protect the complete website including your content in the folder and also database and helps to recover from any disaster.
With the recent addition of MySQL support to the Data protection software, now you can create the application aware backup for the MySQL databases as well
NIMESA is a unified cloud data protection solution and an application-aware for major business applications running in AWS EC2 Instances. It delivers simple and cost-effective solutions for business continuity and AWS disaster recovery with SLA driven backup policies using AWS EBS snapshot technology.
Setting up WordPress in AWS EC2
In AWS marketplace or community lot of AMIs available for LAMP stack or fully installed WordPress. I chose the Bitnami WordPress AMI, which uses the Ubuntu LTS and pre-install all the required software including apache httpd server, MySQL Server, PhpMyAdmin, Webmin
After the successful creation of the instance, I can see the Hello world post on my homepage
Prepare the WordPress EC2 instance for backup
- First SCP the Nimesa MySQL-agent-installer file to the WordPress instance and ssh into it.
- Install Java 8 runtime
- Install mysql-agent to create the backup with MySQL application-consistent
- And allow the nimesa MySQL agent service port in the instance security groups for Nimesa to communicate with the service running in the WordPress instance
Creating the Backup policy
In Nimesa, create a backup policy with app aware backup enabled and MySQL chosen, You can configure the backup timeout based on your requirement
Backup Group with WordPress Instance
Create a backup group with the WordPress EC2 instance and associate the MySQL backup policy and the credentials ( user should have reload privilege in MySQL), After the backup group creation, the new backup will be triggered based on the schedule
The Backup operation will apply the read lock on the tables and create a snapshot,
Quiescing MySQL database by locking tables
Read lock applied successfully on MySql tables
Creating snapshot of volume vol-0827ab7aa1d62
Initiated Mysql database discovery
MySQL table lock released
- Admin can restore the whole WordPress instance in case of any issue on the instance
- Admin can quickly clone the instance instantaneously to do the check before the restore
- Clone instance for the dev use cases
- If admins want to recover any individual file, user can do the file level recovery
- Instead of restoring the whole instance to recover the data in the database, admin can do the database restore
Disclaimer: The scripts/code in this post are given as-is without any warranties. Please consider them as guidelines. Please don’t use them in your production environment until thoroughly testing them and making sure the processes work correctly.
Also published on Medium.