How to migrate instances between DreamCompute clusters

Overview

DreamCompute offers multiple clusters (also often called availability zones) which are independent OpenStack installations with their own servers, storage, and control panel. Some clusters have different features, such as SSD storage or different hardware that is useful for a given task. Migrating instances and data between clusters is not automated at this time, but this guide shows you how to accomplish this yourself.

This guide assumes that you are comfortable working with SSH as well as some command line utilities like dd and the OpenStack CLI. For more information about those utilities, see the articles below.

Things to keep in mind

Here are a few things to keep in mind and plan before a migration.

IP addresses will change

Each cluster has assigned blocks of IP addresses, therefore floating IPs, public IPv4, and public IPv6 addresses cannot be transferred between clusters. If you are using private networks (optional in US-East 2), the specific assigned 10.x.x.x address may also change.

SSH keys

Each cluster manages its SSH Keys separately, so if you have your keys already set up in the source cluster, you must set up the same keys (or new ones) in the destination cluster. You can grab the public key of any key pair in your project from the ('Project' > 'Compute' > 'Key Pairs') page of the DreamCompute dashboard.

To get to that page, just click on the key pair name.

Plan a maintenance window

To avoid open files causing corruption or other odd behavior, it is safest to move the data when the instance is not running. The copying of the data is generally fairly quick for smaller volumes, but for larger volumes it could take some time. Remember, the copy must complete before service can be restored.

Additionally, DNS must be updated from the old public IPs to the new ones. Depending on the time to live (TTL) of your DNS provider, this process can take a matter of minutes up to 24 hours. DNS zones managed by DreamHost can have the TTL changed from 4 hours to 5 minutes if you contact support at least 24 hours in advance of your changes. This can help minimize propagation time.

Ephemeral instances

Ephemeral instances cannot have their data accessed by other instances when they are shut off. These instances can only be migrated while running, so it is best to shut down as many services as possible to limit the possibility of corruption. Please see the last section below for instructions on migrating running instances.

Migrating a volume-backed instance using the OpenStack CLI

For this type of move, it is necessary to delete the instance so that it leaves behind a volume to migrate.

This method requires that you did not select "Yes" for the "Delete Volume on Instance Delete" option when you created your instance. If you did, please skip to the last section for instructions on migrating running instances. If you continue, you may permanently destroy and lose your data.

As an overview, here are the components involved in accomplishing this task:

Migration procedure

Create a temporary "copy machine" by launching a new instance using the smallest available flavor. This guide uses Ubuntu 14.04, but the commands should be similar on any Ubuntu system. It is also recommended that you make the instance ephemeral since it will not be needed after the migration is complete.

Install the needed software to access the Glance image service on this new instance:

After downloading the file, either upload it to your instance or copy/paste its contents into a file on the instance. In the example below, the contents have been saved into a file named 'dreamcompute-CLUSTER.sh', but you can name it anything you like. Once you finish, execute the file:

[root@server]# . dreamcompute-CLUSTER.sh

Enter your DreamCompute password at the "Please enter your OpenStack Password" prompt. This is the same password you use to log into the DreamCompute dashboard.

Now that your shell session has the necessary authentication credentials to connect to the DESTINATION cluster, run the following command to see the OpenStack images currently in the DESTINATION cluster:

[root@server]# openstack image list

Delete the instance you wish to move, freeing up its volume so it can be attached to the newly-created instance.

To attach the volume to the new instance, go to the Volumes menu, click on the drop-down box in the 'Actions' column on the right side, then click 'Edit Attachments'.

Determine the drive letter of the new volume. Generally /dev/vda will be the boot drive of your instance, so it may be /dev/vdb or /dev/vdc. One way to check for it is with the fdisk command:

The one that matches the size of the new volume is the one to use. Make note of the drive letter (the /dev/vdX part).

Use dd to pipe the data directly into the glance image service. Don't forget to change the drive letter in the example below to the one you found above. You can also change any text in all CAPS to suit your taste.

Wait for this command to finish running. If successful, it should output the info about the new image that was created.

You are now ready to go to the DESTINATION cluster to start up a new instance and to select the image that was just uploaded as the source. If the data is meant to be persistent, it is best to specify that you want to create a new volume in the "Source" tab when launching the new instance.

Migrating an ephemeral instance using the OpenStack CLI

This type of migration is not recommended. However it may be necessary in some situations and so is included here.

Shut down as many services on the instance as possible (such as database servers, http servers, and so on), ideally leaving only default system tools and sshd running.

Install the needed software to access the glance imaging service on the instance:

After downloading the file, either upload it to your instance or copy/paste its contents into a file on the instance. In the example below, the contents have been saved into a file named 'dreamcompute-CLUSTER.sh', but you can name it anything you like. Once you finish, execute the file:

[root@server]# . dreamcompute-CLUSTER.sh

Enter your DreamCompute password at the "Please enter your OpenStack Password" prompt. This is the same password you use to log into the DreamCompute dashboard.

Now that your shell session has the necessary authentication credentials to connect to the DESTINATION cluster, run the following command to see the OpenStack images currently in the DESTINATION cluster:

[root@server]# openstack image list

Determine the drive letter by examining the output of df -h for the root (/) filesystem. Generally this is /dev/vda1.

Use dd to pipe the data from the disk directly into the glance image service. Change any text in all CAPS to suit your taste.

Wait for the command to finish running. If successful, it should output the info about the new image that was created.

You are now ready to go to the DESTINATION cluster to start up a new instance and to select the image that was just uploaded as the source. If the data is meant to be persistent, it is best to specify that you want to create a new volume in the "Source" tab when launching the new instance.

Did this article answer your questions?

Sending feedback...

This form is only for article feedback. If you require assistance, please contact support.
How can we improve this page?

Thank you for your feedback!

We'll use it to improve the Knowledge Base.

If you still require assistance, and you're an existing DreamHost customer, please contact support.

If you're not a customer yet, please contact our sales team for further assistance.