Site Crash – Testing Disaster Recovery!


“Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!”

Well, not exactly.  The system crashed – Well, not exactly, I messed up a setting in AWS. WordPress behaved properly, but user error brought down the site. Luckily, I had and xml backup of my content moments before.  However, there are a couple of important lessons learned:

1) The XML backup does not import images.  I need to do that manually.  It may/may not happen on historical posts.  Forgive me.

2) Never hit the Terminate button in aws unless you know what you are doing.  It took me 2 days to get back to where I am today.

3a) Lesson learned – I was actually in the process of establishing the backup/restore process when I setup something incorrect and the entire sight crashed.  – Lesson learned – Do this earlier in the process.  It look like a “image” can be saved from the right-click menu inside the EC2 dashboard.  I would do that sooner than later.

3b)  The backup/restore of wordpress does not include page layout and/or themes, it only includes content.  I have to redo the outwardly facing pages.

Moving my Old Links

Because my IP address changed, and everything on the site is still based on IP, I had a hard time moving all of my references.  There were really two ways of doing this (I found out)

Easy Way – Search and replace the XML file prior to uploading it.

Hard way – Use MySQL Commands:

mysql> select option_name, option_value From wp_options WHERE option_name = 'siteurl'
-> ;
+-------------+----------------------+
| option_name | option_value         |
+-------------+----------------------+
| siteurl     | http://52.24.212.236 |
+-------------+----------------------+
1 row in set (0.00 sec)

mysql> UPDATE wp_options SET option_value ='http://52.24.147.87/' WHERE option_name = 'siteurl';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select option_name, option_value From wp_options WHERE option_name = 'siteurl';
+-------------+----------------------+
| option_name | option_value         |
+-------------+----------------------+
| siteurl     | http://52.24.147.87/ |
+-------------+----------------------+
1 row in set (0.00 sec)

mysql> select option_name, option_value From wp_options WHERE option_name = 'home';
+-------------+----------------------+
| option_name | option_value         |
+-------------+----------------------+
| home        | http://52.24.212.236 |
+-------------+----------------------+
1 row in set (0.00 sec)

mysql> UPDATE wp_options SET option_value ='http://52.24.147.87/' WHERE option_name = 'home';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select option_name, option_value From wp_options WHERE option_name = 'home';
+-------------+----------------------+
| option_name | option_value         |
+-------------+----------------------+
| home        | http://52.24.147.87/ |
+-------------+----------------------+
1 row in set (0.00 sec)

mysql> commit
-> ;
Query OK, 0 rows affected (0.00 sec)

Now it is time to replace the old links with the new ones.

mysql> UPDATE wp_posts
SET guid =
REPLACE(
guid,
"54.191.107.214",
"52.24.147.87"
);

 

Leave a comment

Your email address will not be published. Required fields are marked *