9 Server Migration

In this enterprise topology, you must configure server migration for the WLS_SOA1 and WLS_SOA2 managed servers. The WLS_SOA1 managed server is configured to restart on SOAHOST2 should a failure occur. The WLS_SOA2 managed server is configured to restart on SOAHOST1 should a failure occur. For this configuration, the WLS_SOA1 and WLS_SOA2 servers listen on specific floating IPs that are failed over by WLS Server Migration. Configuring server migration for the WLS_SOAn managed servers consists of the following steps:

9.1 Setting Up a User and Tablespace for the Server Migration Leasing Table

The first step is to set up a user and tablespace for the server migration leasing table:

  1. Create a tablespace called leasing. For example, log on to SQL*Plus as the sysdba user and run the following command:

    SQL> create tablespace leasing
            logging datafile 'DB_HOME/oradata/orcl/leasing.dbf'
            size 32m autoextend on next 32m maxsize 2048m extent management local;
    
  2. Create a user named leasing and assign to it the leasing tablespace.

    SQL> create user leasing identified by welcome1;
    
    SQL> grant create table to leasing;
    
    SQL> grant create session to leasing;
    
    SQL> alter user leasing default tablespace leasing;
    
    SQL> alter user leasing quota unlimited on LEASING;
    
  3. Create the leasing table using the leasing.ddl script.

    1. Copy the leasing.ddl file located in either the WL_HOME/server/db/oracle/817 or the WL_HOME/server/db/oracle/920 directory to your database node.

    2. Connect to the database as the leasing user.

    3. Run the leasing.ddl script in SQL*Plus.

      SQL> @copy_location/leasing.ddl;
      

9.2 Creating a Multi-Data Source Using the Oracle WebLogic Server Administration Console

The second step is to create a multi-data source for the leasing table from the Oracle WebLogic Server Administration Console:

You create a data source to each of the Oracle RAC database instances during the process of setting up the multi-data source, both for these data sources and the global leasing multi-data source. When you create a data source:

  • Make sure that this is a non-xa data source

  • The names of the multi-data sources are in the format of <MultiDS>-rac0, <MultiDS>-rac1, and so on

  • Use Oracle's Driver (Thin) Version 9.0.1, 9.2.0, 10, 11

  • Use Supports Global Transactions, One-Phase Commit, and specify a service name for your database

  • Target these data sources to the SOA cluster

  • Make sure the datasources' connection pool initial capacity is set to 0. To do this, select Services, JDBC, and then Datasources. In the Datasources screen, click the Datasource Name, then click the Connection Pool tab, and enter 0 in the Initial capacity field.

Creating a Multi-Data Source

To create a multi-data source, complete these steps:

  1. From Domain Structure window in the Oracle WebLogic Server Administration Console, expand the Services node, then expand the JDBC node.

  2. Click Multi Data Sources. The Summary of JDBC Multi Data Source page appears.

  3. Click Lock and Edit.

  4. Click New.

    The Create a New JDBC Multi Data Source page appears.

  5. Enter leasing as the Name

  6. Enter jdbc/leasing as the JNDI name.

  7. Select Failover as algorithm (default).

  8. Click Next.

  9. Select SOA_Cluster as the target.

  10. Click Next.

  11. Select non-XA driver (the default).

  12. Click Next.

  13. Click Create New Data Source.

  14. Enter leasing-rac0 as name. Enter jdbc/leasing-rac0 as JNDI name. Enter oracle as the database type. For the driver type, enter Oracle Driver (Thin) for RAC server-Instance connection Version 10,11.

    Note:

    When creating the multi-datasources for the leasing table, enter names in the format of <MultiDS>-rac0, <MultiDS>-rac1, and so on.
  15. Click Next.

  16. Deselect Supports Global Transactions.

  17. Click Next.

  18. Enter the service name, database name, host port, and password for your leasing schema.

  19. Click Next.

  20. Click Test Configuration and verify the connection works.

  21. Click Next.

  22. Target the data source to SOA_Cluster.

  23. Select the data source and add it to the right screen.

  24. Click Create a New Data Source for the second instance of your Oracle RAC database, target it to SOA_Cluster, repeating the steps for the second instance of your Oracle RAC database.

  25. Add the second data source to your multi-data source.

  26. Click Activate Changes.

9.3 Enabling Host Name Verification Certificates between SOAHOST1 and SOAHOST2 and the Administration Server

The third step is to create the appropriate certificates for host name verification between the Node Manager and the Administration Server. This procedure is described in Section 8.3, "Enabling Host Name Verification Certificates for Node Manager in SOAHOST1" and Section 8.5, "Enabling Host Name Verification Certificates for the Node Manager in SOAHOST2."

9.4 Editing the Node Manager's Properties File

The fourth step is to edit the Node Manager's properties file. This needs to be done for the node managers in both nodes where server migration is being configured. The nodemanager.properties files is located in the WL_HOME/common/nodemanager directory:

Interface=eth0

NetMask=255.255.255.0

UseMACBroadcast=true

  • Interface

    This property specifies the interface name for the floating IP (for example, eth0).

    Note:

    Do not specify the sub interface, such as eth0:1 or eth0:2. This interface is to be used without the :0, or :1. The Node Manager's scripts traverse the different :X enabled IPs to determine which to add or remove. For example, the valid values in Linux environments are eth0, eth1, or, eth2, eth3, ethn, depending on the number of interfaces configured.
  • NetMask

    This property specifies the net mask for the interface for the floating IP. The net mask should the same as the net mask on the interface; 255.255.255.0 is used as an example in this document.

  • UseMACBroadcast

    This property specifies whether or not to use a node's MAC address when sending ARP packets, that is, whether or not to use the -b flag in the arping command.

Verify in Node Manager's output (shell where Node Manager is started) that these properties are being used, or problems may arise during migration. You should see something like this in the Node Manager's output:

...
StateCheckInterval=500
Interface=eth0
NetMask=255.255.255.0
...

Note:

The steps below are not required if the server properties (start properties) have been properly set and the Node Manager can start the servers remotely.
  1. Set the following property in the nodemanager.properties file.

    • StartScriptEnabled

      Set this property to true. This is required for the shiphome to enable the Node Manager to start the managed servers.

  2. Start the Node Manager on Node 1 and Node 2 by running the startNodeManager.sh script located in the WL_HOME/server/bin directory.

Note:

When running Node Manager from a shared storage installation, multiple nodes are started using the same nodemanager.properties file. However, each node may require different NetMask or Interface properties. In this case, specify individual parameters on a per-node basis using environment variables. For example, to use a different interface (eth3) in SOAHOSTn, use the Interface environment variable as follows: SOAHOSTn> export JAVA_OPTIONS=-DInterface=eth3 and start Node Manager after the variable has been set in the shell.

9.5 Setting Environment and Superuser Privileges for the wlsifconfig.sh Script

The fifth step is to set environment and superuser privileges for the wlsifconfig.sh script:

  1. Ensure that your PATH environment variable includes these files:

    Table 9-1 Files Required for the PATH Environment Variable

    File Located in this directory

    wlsifconfig.sh

    ORACLE_BASE/admin/<domain_name>/mserver/<domain_name>/bin/server_migration

    wlscontrol.sh

    WL_HOME/common/bin

    nodemanager.domains

    WL_HOME/common/nodemanager


  2. Grant sudo configuration for the wlsifconfig.sh script.

    • Configure sudo to work without a password prompt.

    • For security reasons, sudo should be restricted to the subset of commands required to run the wlsifconfig.sh script. For example, to set the environment and superuser privileges for the wlsifconfig.sh script, complete these steps:

      1. Grant sudo privilege to the WebLogic user ('oracle') with no password restriction, and grant execute privilege on the /sbin/ifconfig and /sbin/arping binaries.

      2. Make sure the script is executable by the WebLogic user ('oracle'). The following is an example of an entry inside /etc/sudoers granting sudo execution privilege for oracle and also over ifconfig and arping:

        oracle ALL=NOPASSWD: /sbin/ifconfig,/sbin/arping
        

    Note:

    Ask the system administrator for the sudo and system rights as appropriate to this step.

9.6 Configuring Server Migration Targets

The sixth step is to configure server migration targets. Configuring Cluster Migration sets the DataSourceForAutomaticMigration property to true. Follow the steps below to configure cluster migration in a migration in a cluster:

  1. Log into the Oracle WebLogic Server Administration Console (http://<host>:<adminPort>/console. Typically, adminPort is 7001 by default).

  2. In the Domain Structure window, expand Environment and select Clusters. The Summary of Clusters page appears.

  3. Click the cluster for which you want to configure migration (SOA_Cluster) in the Name column of the table.

  4. Click the Migration tab.

  5. Click Lock and Edit.

  6. In the Available field, select the machine to which to allow migration and click the right arrow. In this case, select SOAHOST1 and SOAHOST2.

  7. Select the data source to be used for automatic migration. In this case select the leasing data source.

  8. Click Save.

  9. Click Activate Changes.

  10. Set the Candidate Machines for Server Migration. You must perform this task for all of the managed servers as follows:

    1. In Domain Structure window of the Oracle WebLogic Server Administration Console, expand Environment and select Servers.

    2. Select the server for which you want to configure migration.

    3. Click the Migration tab.

    4. In the Available field, located in the Migration Configuration section, select the machines to which to allow migration and click the right arrow. For WLS_SOA1, select SOAHOST2. For WLS_SOA2, select SOAHOST1.

    5. Select Automatic Server Migration Enabled. This enables the Node Manager to start a failed server on the target node automatically.

    6. Click Save.

    7. Click Activate Changes.

    8. Restart the Administration Server and the servers for which server migration has been configured

      To restsart the Administration Server, use the procedure in Section 4.7, "Starting the Administration Server on SOAHOST1."

    Tip:

    Click Customize this table in the Summary of Servers page, move Current Machine from the Available Window to the Chosen window to view the machine on which the server is running. This will be different from the configuration if the server gets migrated automatically.

9.7 Testing the Server Migration

The seventh and final step is to test the server migration. To verify that Server Migration is working properly, follow these steps:

From Node 1:

  1. Stop the WLS_SOA1 managed server.

    To do this, run this command:

    SOAHOST1> kill -9 <pid>
    

    pid specifies the process ID of the managed server. You can identify the pid in the node by running this command:

    SOAHOST1> ps -ef | grep WLS_SOA1
    
  2. Watch the Node Manager console: you should see a message indicating that WLS_SOA1's floating IP has been disabled.

  3. Wait for the Node Manager to try a second restart of WLS_SOA1. Node Manager waits for a fence period of 30 seconds before trying this restart.

  4. Once Node Manager restarts the server, stop it again. Now Node Manager should log a message indicating that the server will not be restarted again locally.

From Node2:

  1. Watch the local Node Manager console. After 30 seconds since the last try to restart WLS_SOA1on Node 1, Node Manager on Node 2 should prompt that the floating IP for WLS_SOA1 is being brought up and that the server is being restarted in this node.

  2. Access the soa-infra console in the same IP.

Verification From the Administration Console

Migration can also be verified in the Administration Console:

  1. Log into the Administration Console.

  2. Click on Domain on the left console.

  3. Click the Monitoring tab and then the Migration subtab.

    The Migration Status table provides information on the status of the migration.

    Figure 9-1 Migration Status Screen in the Administration Console

    Description of Figure 9-1 follows
    Description of "Figure 9-1 Migration Status Screen in the Administration Console"