Parallels H-Sphere Documentation System Administrator Guide

 

Migrating Winbox

(H-Sphere 2.3.x-2.4.x)
 
 

Related Docs:   Migrating Winbox (H-Sphere 2.4.x) Recovering Winbox Server Migration Request: Cautions for Winbox Server

Last modified: 27 Dec 2007

 

WARNING: This documentation covers Parallels H-Sphere versions up to 3.1. For the latest up-to-date Parallels H-Sphere documentation, please proceed to the official Parallels site.

This is a draft for your consideration. Don't use it in production environment.

This document explains how to migrate H-Sphere winbox to a different server. If you run H-Sphere of 2.4 branch, consider also winbox migration instructions for H-Sphere 2.4.x.

Commercial products. This procedure doesn't move products such as MS SQL and Miva. In order to use them on the new server, you need to install them manually before the migration.
Web statistics. You may lose AWStats and Webalizer statistics for the time of migration.

1. Prepare Source And Target Servers
1.1. Update H-Sphere on the source box.
1.2. Install H-Sphere winbox software on the target box.
1.3. Clean up HShome directory from orphaned files and folders.
2. Create Users On The Target Server
2.1. Export usernames and passwords from the source server into a file.
2.2. Import usernames and passwords from file to the source server.
3. Recreate H-Sphere Resources
3.1. Disable SOAP on the CP server.
3.2. Move user content using the rsync tool.
3.3. Comment out the content of adduser.asp.
3.4. Rename directory for user homes on the target box.
3.5. Stop HSQuotas on the target box for the time of migration.
3.6. Trim the skeleton on the target box.
3.7. Change the IP of the target physical server.
3.8.
Run physical creator on the CP box.
3.9. Rename back the directory for user homes.
4. Manual Post-recreate steps
4.1. Install Shared SSL certificates.
4.2. Export user SSL certificates from the source box to the target box.
4.3. Install ASP.NET for all users that have it enabled.
4.4. Repeat content move.
4.5. Stop rsync on the target box.
4.6. If you run dedicated IPs, set them up on the target box and delete them from the source box.
4.7. Upgrade target winbox to recover stopped and commented scripts and services.

 

Step 1.1. Update H-Sphere on the source box

Update H-Sphere to the leatest build of 2.3.2 or 2.4.x. Please refer to the table of versions for instructions.

 

Step 1.2. Install H-Sphere winbox software on the target box

The target box must have a fresh install of Windows 2000 or 2003 server as required in Preparing Winbox and Winbox Installation manuals. Don't set up customer accounts or domains.

 

Step 1.3. Clean up HShome directory from orphaned files and folders

Before migration we highly recommend cleaning your HShome from orphaned files and folders in order to migrate only relevant content.

 

Step 2.1. Export usernames and passwords from the source server into a file

  1. Disable Signup on the source server for the time of migration to avoid data loss.
  2. Log into the system database.
  3. Run the following DB query to select the usernames and passwords replacing ??? with the id of the source logical server:
    select login, password from unix_user where hostid=???;
  4. Copy the result of the query into a text file removing redundant spaces. Save the file in the directory <DISK>\hsphere\scripts\, and name it, for instance, users.txt. It will have the following format:
    username1 pwd1
    username2 pwd2
    ...
    usernameN pwdN

 

Step 2.2. Import usernames and passwords from file to the source server

  1. Make file createusers.asp with the following content:
    
    <%@ LANGUAGE=JScript %>
    <!-- #include file ="consts.inc" -->
    <!-- #include file ="conf.inc" -->
    <%
     Server.ScriptTimeout = 600
    
     inetSrv = Server.CreateObject(comRsrcManager)
     Server.Execute("/cfg/set-config.asp")
    
     fs = new ActiveXObject("Scripting.FileSystemObject");
     a = fs.OpenTextFile(Server.MapPath("/cfg/users.txt"), 1, false);
    
     diskQuota = Server.CreateObject("Microsoft.DiskQuota.1")
    
    
     while (!a.AtEndOfLine)
     {
      record =  a.ReadLine();
    
      tokens = record.split(new RegExp("[ \n\r\t]"));
    
      user = tokens[0];
      password = tokens[1];
    
      errCode = 0
    
      aOptions = new Array(useDedicatedUsersGroup)
      flags = new Array(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096,
    8192, 16384)
      options = 0
      for (i = 0; i < aOptions.length; i ++)
      {
       if  (aOptions[i] != 0)
        options |= flags[i]
      }
    
      errCode = inetSrv.CreateUser(user, usersHome + "\\" + user, "settler",
    password, logPath, options)
      if  (errCode != 0)
       Response.Write("User: " + user + " failed<BR>\n")
      else
       Response.Write("User: " + user + " = Ok<BR>\n")
      Response.Flush()
    
     }
    
     a.Close();
    %>
    
  2. Save this file in the <DISK>\hsphere\scripts\ directory and run it with the browser:
    http://TARGET_WINBOX_IP/cfg/createusers.asp
  3. Check the results:
    find "CreateUser(" <DISK>\hsphere\logs\action.log /c
    find "\hslogfiles, 1 ) = 0" <DISK>\hsphere\logs\action.log /c

 

Step 3.1. Disable SOAP

This step is especially important for H-Sphere 2.4.
  1. On the CP server, open the hsphere.properties file:
    vi ~cpanel/shiva/psoft_config/hsphere.properties
  2. Comment out the line
    SOAP_SUPPORT=TRUE
  3. Restart H-Sphere CP.

 

Step 3.2. Move content using the rsync tool

  1. Check your service processes to make sure that HSquotas is running.
  2. In the directory <DISK>:\hsphere\rsync on the target server, create file rsync.conf with the following content:
    log file = ./rsync.log
    use chroot = false
    strict modes = false
    hosts allow = *
    
    [UNIQUE_SESSION_ID_STRING]
            path = <DISK>:\hshome
        read only = false
            comment = content area
        list = false
    
  3. Run rsync-start.asp with the browser and follow the authorization wizard for the user that was created during H-Sphere Windows software installation (usually HSadmin). If successful, you'll see a 0 (zero) on the last screen. To run rsync-start.asp, type the following line in the browser address field:
    http://TARGET_WINBOX_IP/cfg/rsync-start.asp
  4. In the <DISK>\hsphere\rsync directory on the source server, create file rsynccontent.bat with the following content:
    rem %1 = path to content to move
    rem %2 = cygwin path to content to move
    rem %3 = traget IP
    rem %4 = target module name
    rem FOR /F "usebackq delims=" %%i IN (`dir /B/A:D %1`) DO rsync.exe -avpgoz "/cygdrive/%2/%%i" %3::%4
    rem The following line for moving content without compression
    FOR /F "usebackq delims=" %%i IN (`dir /B/A:D %1`) DO rsync.exe -av "/cygdrive/%2/%%i" %3::%4
    
  5. In the command prompt, launch content move from the source server to the target server:
    rsynccontent.bat <DISK_WITH_USER_HOMES_ON_SOURCE_SERVER>:\hshome <DISK_LETTER>/hshome TARGET_WINBOX_IP UNIQUE_SESSION_ID_STRING > rs.log
    For example:
    rsynccontent.bat e:\hshome e/hshome 192.0.34.166 asdfasdf-b041-4d62-8a9f-qwerqwerqwer > rs.log

 

Step 3.3. Comment out the content of adduser.asp

Replace the content of adduser.asp with the following code. Later the old content will be recovered during H-Sphere update on the Winbox.

<%@ LANGUAGE=JScript %>

<%
     Response.Write(0 + "\n" + 1 + "\n")

%>

 

Step 3.4. Rename directory with user homes on the target box.

When content move ends, rename the directory with user homes on the target box not to lose it during the recreation process. To do this:

  1. Stop IIS by running the following commands in the commmand prompt, one by one:
    iisreset /stop
    net stop w3svc
    net stop MSFTPSVC
    
  2. Rename the hshome directory.
  3. Create an empty hshome directory.

 

Step 3.5. Stop HSQuotas on the target box for the time of migration.

Run the following command in the command prompt on the target server:

net stop HsQuotas

 

Step 3.6. Trim the skeleton on the target box.

  1. Remove the content of the directory HSphere\skeleton.
  2. Download file skeleton_empty.exe into this directory.
  3. Execute skeleton_empty.exe from the command line with parameters:
    skeleton_empty.exe -extract -Directories

 

Step 3.7. Change the IP of the target physical server.

  1. In the admin CP, select E.Manager->P.Servers
  2. Click the name of the server
  3. In the IP 1 field, enter the new IP of the server.
    In the Mask 1 field, enter the mask for this IP.

 

Step 3.8. Run PhysicalCreator on the CP box

  1. Go to the H-Sphere admin control panel, select P.Servers of the E.Manager -> Servers menu, and click server info for the Winbox in question.
  2. Check if server info shows on the page that appears. If not, the CP server can't communicate with the Winbox; make sure to fix this issue before proceeding.
  3. Downolad tail utility for Windows and put it in the directory WINDOWS(win2003) or into WINNT(win2000).
  4. Log into the system database and run the following DB query to find out the number of domains to create, replacing ??? with the ID of the logical server you are migrating:
    select count(*) from iis_vhost i, parent_child p, accounts a, user_account ua where i.id=p.child_id and p.account_id = a.id and a.deleted is null and ua.account_id = a.id and (a.demo <> 1 OR demo IS NULL) and host_id = ???;
  5. Run PhysicalCreator as the cpanel user:
    java -Xms64M -Xmx512M psoft.hsphere.tools.PhysicalCreator -rg winweb -co -lid LOGICAL_SERVER_ID > creator.log 2>&1 &

    More on PhysicalCreator
  6. In the command line on the Winbox, run tail -f action.log to monitor the creation of Winbox resources.
  7. In another command line window, periodically check the number of created domains by running:
    find "CreateWebHost(" <HS_DIRECTORY>\logs\action.log /c
    for example:
    find "CreateWebHost(" d:\hsphere\logs\action.log /c

 

Step 3.9. Rename back the directory for user homes

  1. Stop IIS by running the following commands in the commmand prompt, one by one:
    iisreset /stop
    net stop w3svc
    net stop MSFTPSVC
    
  2. Remove the hshome directory.
  3. Rename the directory with user homes back to hshome.

 

Step 4.1. Install Shared SSL Certificates

  1. In the admin control panel, install completely new Certificate key and file pair You can get them in /hsphere/shared/apache/conf/ssl.shared/[domain.name]/ on any Unix/Linux web server. This will repost the wildcard certificate on all servers, including the Winbox you are migrating.
  2. Download Recreation scripts in a zip archive and unpack them to a separate directory on the Winbox, for example recreation_scripts.
  3. Log into the system database and run the following DB query to select the domain names with shared SSL enabledreplacing ??? with the ID of the logical server you are migrating:
    select s.name,hostnum,d.name from shared_ssl s, parent_child p1, parent_child p2, domains d, iis_vhost h where s.id = p1.child_id and p1.parent_id = p2.child_id and p2.parent_id = d.id and p2.child_id = h.id and h.host_id= ???;
  4. Copy results of the query into a text file in the recreation_scripts directory and name it, for instance, S_SSL.txt. It will have the following format:
    sname1 | hostnum1 | domain_name1
    sname2 | hostnum2 | domain_name2
    ...
    snameN | hostnumN | domain_nameN
    where:
    snameX - is the third level domain secured with the wildcard certificate, e.g. user22.yourdomain.com
    hostnumX - is the domain ID in IIS
    domain_nameX - is the corresponding second level domain, e.g. user22.com.
  5. Enter the recreation_scripts directory and run the following command:
    sslprepare.bat %1 %2 %3 %4 %5 > SetSSL.txt
    where:
    rem %1 - is the file name you have created (e.g. S_SSL.txt)
    rem %2 - Winbox IP
    rem %3 - Service domain used for shared SSL
    rem %4 - H-Sphere login used at Winbox installation
    rem %5 - H-Sphere password used at Winbox installation.
  6. Open SetSSL.txt and remove the first part leaving only the list of links.
  7. Run the following command:
    WGET.EXE -i SetSSL.txt
    This will install all Shared SSL resources on the Winbox.

 

Step 4.2. Export user SSL certificates from the source box to the target box

User SSL certificates must be moved one by one.

  1. On the source box, open the MMC console.
  2. If you are in Logical Certificate Stores view mode, in the console tree, click Certificates.
  3. Right click a certificate and select All Tasks->Export.
  4. Follow the wizard choosing the following settings:
    * Yes, export the private key
    * Include all certificates in the certtification path if possible
  5. On the target box, go to the same certificates console
  6. Right click the area where the certificates must show and choose All Tasks->Import.
  7. Follow the wizard choosing the following settings:
    * Mark the private key as exportable
    * Automatically select the certificate store based on the type of certificate

Repeat these steps for all user certificates.

 

Step 4.3. Install ASP.NET for all users that have it enabled

On this step, we will use scripts in the recreation_scripts directory.

  1. Log into the system database and run the following DB query to select the domain names with ASP.NET support enabled:
    select d.name,i.hostnum from parent_child p1,parent_child p2,parent_child p3,parent_child p4,domains d,iis_vhost i where i.host_id=??? and p1.child_id = i.id and p1.parent_id = p2.child_id and d.id = p2.child_id and p3.parent_id=p2.child_id and p4.parent_id=p3.child_id and p4.child_type=63;
    replacing ??? with the ID of the logical server you are recovering.
  2. Copy results of the query into a text file in the recreation_scripts directory and name it, for instance, aspnet.txt.
  3. Enter the recreation_scripts directory and run the following command:
    aspnetprepare.bat %1 %2 %3 %4 > aspnet_links.txt
    where:
    rem %1 - file name, e.g. aspnet.txt
    rem %2 - Winbox IP
    rem %3 - H-Sphere login used at Winbox installation
    rem %4 - H-Sphere password used at Winbox installation.
  4. Open aspnet_links.txt and remove the first part leaving only the list of links.
  5. Run the following command:
    WGET.EXE -i aspnet_links.txt
    This will install all ASP.NET resources on the Winbox.

 

Step 4.4. Repeat Content Move

  1. Check your service processes to make sure that HSquotas is running.
  2. Repeat exactly the same steps you did for content move above to synchronize the content that was changed during the migration steps.

 

Step 4.5. Stop rsync on the target box

Run rsync-stop.asp with the browser and follow the authorization wizard. If successful, you'll see a 0 (zero) on the last screen. To run rsync-stop.asp, type the following line in the browser address field:

http://TARGET_WINBOX_IP/cfg/rsync-stop.asp

 

Step 4.6. If you run dedicated IPs, set them up on the target box and delete them from source

  1. In the browser, run ip-delete.asp to delete dedicated IPs on the source box and follow the authorization wizard for the user that was created during H-Sphere Windows software installation (usually HSadmin). If successful, you'll see a 0 (zero) on the last screen. To run ip-delete.asp, type the following line in the browser address field:
    http://SOURCE_WINBOX_IP/cfg/ip-delete.asp?IP=IP_Adress
  2. In the browser, run ip-create and follow the wizard to create dedicated IPs on the target box:
    http://TARGET_WINBOX_IP/cfg/ip-create.asp?IP=IP_Adress

More on IP Management tools


Related Docs:   Migrating Winbox (H-Sphere 2.4.x) Recovering Winbox Server Migration Request: Cautions for Winbox Server



© Copyright 2017. Parallels Holdings. All rights reserved.