Version 5 (modified by 15 years ago) ( diff ) | ,
---|
How do I move a hosting order from one server to another server?
This help page is intended for May First/People Link administrators. Root access to the servers in question is required.
To help distribute load evenly between our standard servers, it is sometimes necessary to move a hosting order from one server to another. These steps document a process for making a move that allows you to copy and test the move before making a final commitment.
Create the appropriate items in the Members Control panel
The first step is to run the transfer-red-items-to-new-host
script from harry.mayfirst.org:
- Login as root:
ssh root@harry.mayfirst.org
- Become the www-data user (which has the ability to notify hosts of item changes)
su www-data
- Execute the script (below is a sample transcript)
0 harry:~$ cd /usr/local/share/red/ui/sbin/ 0 harry:~$ ./transfer-red-items-to-new-host Please enter the domain name of the hosting order to move? apen.ourpowerbase.net Hosting Order ID: 1000117 Member: Progressive Tech Current host: julia.mayfirst.org Please enter the full domain name of the new host. ella.mayfirst.org Crank down time to live for DNS to 300 seconds? [Yn] y Cranking down time to live for DNS to 300 seconds Pseudo-terminal will not be allocated because stdin is not a terminal. DNS record updated for apen.ourpowerbase.net Pseudo-terminal will not be allocated because stdin is not a terminal. DNS record updated for www.apen.ourpowerbase.net Pseudo-terminal will not be allocated because stdin is not a terminal. DNS record updated for mail.apen.ourpowerbase.net Pseudo-terminal will not be allocated because stdin is not a terminal. DNS record updated for ibew25.mayfirst.org Pseudo-terminal will not be allocated because stdin is not a terminal. DNS record updated for apen.ourpowerbase.net Pseudo-terminal will not be allocated because stdin is not a terminal. DNS record updated for advantage.apen.ourpowerbase.net Create new hosting order? [Yn] Creating new hosting order New hosting order created (1000145) Using temp hosting order id: 1000145 Transfer relevant red items to new host (1000145)? [Yn] Moving red_items to newly created hosting order and setting as transfer-limbo Done Update old hosting order with new host value? [Yn] Updating hosting order with new host (ella.mayfirst.org) Create new red_items on new host? [Yn] Making duplicate red_items on new host Would you like to validate new red items? [Yn] Working on item: 23103 (User Account) validate'd Working on item: 23104 (Server Access) You can only specify a user account that exists. Errors on validation: Working on item: 23105 (Web Configuration) You must specify a user account that exists. You entered: opbapen. Errors on validation: Working on item: 23301 (Email Address) You must either specify a valid email address or a user account that exists. You entered: opbapen. Errors on validation: Working on item: 23384 (Web Configuration) You must specify a user account that exists. You entered: opbapen. Errors on validation: Would you like to commit new red items? [Yn] Working on item: 23103 (User Account) Pseudo-terminal will not be allocated because stdin is not a terminal. commit'd: 23822 Working on item: 23104 (Server Access) Pseudo-terminal will not be allocated because stdin is not a terminal. commit'd: 23823 Working on item: 23105 (Web Configuration) Pseudo-terminal will not be allocated because stdin is not a terminal. Warning: DocumentRoot [/home/members/progressivetech/sites/apen.ourpowerbase.net/include/nonhttps] does not exist commit'd: 23824 Working on item: 23301 (Email Address) Pseudo-terminal will not be allocated because stdin is not a terminal. commit'd: 23825 Working on item: 23384 (Web Configuration) Pseudo-terminal will not be allocated because stdin is not a terminal. commit'd: 23826 0 harry:/usr/local/share/red/ui/sbin$
Notice the validation errors! You will need to read those carefully. When running just validation, you will get errors about how certain items did not validate because the related user account doesn't exist. That's normal because when validating, you don't actually create the user account. In addition, you might get errors when committing (such as the one above) that reports how a directory doesn't exist yet.
This script will ask you for the domain name of the hosting order you want to transfer and the name of the new host you want to transfer it to.
It does a number of steps for you:
- Cranks down the time to live for the DNS records to 300 seconds
- Creates a new hosting order in the state "transfer-limbo" with the same values as the existing hosting order.
- Re-assigns all existing red items to the new transfer-limbo hosting order. These items remain unchanged on the current host (in other words, user accounts, web sites, etc. continue working on the current host). However, they cannot be modified since they are in transfer-limbo.
- Updates the existing hosting order with the new host.
- Creates a copy of every red item, attaching them to the existing hosting order (and assigning them to the new host).
When you are done, there will be two hosting orders - one that is in transfer-limbo (and is currently active) and one that is installed on the new target host.
Copy data from the current to the new host
Next, copy the data from the current host to the new host by logging into the current host as root (with authentication credentials being forwarded):
ssh -A root@current.host.org
Then, run the /usr/local/share/red/node/sbin/copy-data-to-new-host
script, passing the new host as the first argument and the path to the hosting order as the second. For example:
/usr/local/share/red/node/sbin/copy-data-to-new-host new.host.org /home/members/mayfirst/sites/mayfirst.org
This script will rsync all the data, preserving permissions and ownership, to the new host. Then, it will search for a Drupal database and if it finds one, create it (and the associated username) to the new host and then dump the data. Finally, it will search for crontabs on the current host, re-creating any it finds on the new host.
You can safely run this script as many times as you like.
Note: the script does not detect databases other than those used by Drupal. If the hosting order is using a non-Drupal database you will need to transfer it by hand.
Test
The next step is to test. You can test by modifying your hosts file so that the domain name used by the site your are moving resolves to the IP address of the new host.
Switch
If all goes well with the test, you can finalize the move by modifying the DNS records to point the domain name(s) to the IP of the new host. While you are changing the IP records, be sure to change the time to live back to a reasonable number.
Clean up
Once the transfer has happened, and the site is confirmed to be working and completely intact, you will need to remove the transfer-limbo hosting order:
- From seso, search for the hosting order and click delete. This process will remove all associated red items
- Login to the old host and run
/usr/local/share/red/node/sbin/cleanly-remove-host /path/to/host
This script will manually remove any databases associated with the hosting order, remove any crontabs, remove the hosting order directory.