CDP:Server Swapping Pattern
Problem to Be Solved
When there is a server failure, it is followed by attempts at recovery. While you can consider many causes for failures, often there is no problem with the disk. In such a case, you can swap the problem-free disk to another server to recover quickly. Unfortunately, in a datacenter performing such a swap, including the operations to do so, procurement of a substitute server, installation of the disk, and so forth, takes a lot of work.
Explanation of the Cloud Solution/Pattern
With the Amazon Cloud, the servers are virtual servers, enabling use of virtual disks that can be swapped. If there is a failure in a virtual server, you can swap the disk from the virtual server that has experienced the failure to another virtual server, to restore the system. When compared to physical servers, this eliminates procurement of a machine and also movement by a technician, so the recovery will be fast.
The Elastic Block Store (EBS) exists independently of the EC2 instance, and can be swapped between EC2 instances, allowing you to start up a substitute EC2 instance, and to swap the EBS there, when a failure has occurred.
- Attach the EBS to the EC2 instance and store data there as always.
- When there is a failure in an EC2 instance, start up a virtual server from the same Amazon Machine Image (AMI), and swap, to the new EC2 instance, the EBS used for the data for the failed EC2 instance.
- Set up the middleware and file system again (by, for example, making symbolic links to the newest data), to restore to the state immediately prior to the failure.
- You can use monitoring software (Nagios, Zabbix, Heartbeat, or the like) to automate these processes.
- This lets you to recover to the state immediately prior to the failure of the EC2 instance.
- You can swap the root disk to rapidly recover the operating system (OS) as well.
- Considering the possibility of a failure of the EBS as well, make sure to make backups by taking snapshots, for example.
- You can use this together with Floating IP Pattern to swap not only the the EBS, but the static IP address as well.