Wednesday 1 June 2016

Whole Server Migration - WebLogic 11g

Migration in WebLogic can be categorized broadly into two:
  1. Service Migration
  2. Server Migration


In Service migration, singleton services like JMS, JTA are migrated from one server to another during server failure.
I will discuss Service Migration in another post.


In Server migration, whole server is migrated i.e the failed server is restarted on another node.
To show this, I have 2 Virtual machines, on which I configured a cluster in a domain. After creating a domain, It looks like this:


Admin and MS1 running on - ajMachine1
MS2 running on - ajMachine2



Below are the high level steps for configuring Whole Server Migration:


1. Configure floating IP addresses for each managed server.
2. Set correct sudo privileges for user
3. Configure the node manager on each Machine
4. Configure leasing mechanism.
5. Configure non-xa data source for automatic migration.
6. Configure cluster migration.
7. Configure automatic server migration for each managed server.
8. Test whole server migration.


Step 1
=====
Configure Floating IP address for each host like this, It can be any IP which you assign. But make sure to add them in /etc/hosts file for each node if you are not using any DNS server.


Below if you see, eth6:1 10.0.0.6 is my floating IP on machine 1 and similarly create another VIP  eth6:1 10.0.0.7 for machine 2


Step 2
=====
In /etc/sudoers file, add these lines:




Step 3
======
In nodemanager.properties file, add the below lines, so when you start managed server using NM, it will mount the associated VIP.




Step 4
=====
Run the below queries in Database:
SQL> create tablespace leasing datafile '/u01/app/oracle/oradata/orcl/leasing.dbf' maxsize 2048m extent management local;


Tablespace created.


SQL> create user leasing identified by oracle123;


User created.


SQL> grant create table to leasing;


Grant succeeded.


SQL> grant create session to leasing;


Grant succeeded.


SQL> alter user leasing default tablespace leasing;


User altered.


SQL> alter user leasing quota unlimited on leasing;


User altered.


SQL> exit


Create ACTIVE Table:
=====================
The ddl to create can be found at $WLSERVER_HOME/server/db/oracle/920/leasing.ddl


[oracle@db tmp]$ sqlplus leasing/Password123


SQL*Plus: Release 11.2.0.1.0 Production on Sat May 21 15:09:25 2016


Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> @leasing.ddl
SP2-0734: unknown command beginning "WebLogic S..." - rest of line ignored.
SP2-0734: unknown command beginning "Copyright ..." - rest of line ignored.
DROP TABLE ACTIVE
          *
ERROR at line 1:
ORA-00942: table or view does not exist


Table created.


SQL> desc Active
Name                                      Null?    Type
----------------------------------------- -------- ----------------------------
SERVER                                    NOT NULL VARCHAR2(150)
INSTANCE                                  NOT NULL VARCHAR2(100)
DOMAINNAME                                NOT NULL VARCHAR2(50)
CLUSTERNAME                               NOT NULL VARCHAR2(50)

TIMEOUT                                            DATE


SQL> select * from Active;


no rows selected


Step 5
======
On the Admin Console, create non-xa data source, pointing to leasing schema (created above) and target it to the cluster


Step 6
=====
Navigate to Environments - > Cluster, and click on cluster ->Migration tab.
Update as below:


Step 7
======
Click on MS1 and go to migration tab, and update as below:


Similar for MS2 as well.




Step 8
=====
Now restart all the servers and test the migration.


Kill MS2 and Nodemanager on Node2. After few seconds, you will see, MS2 will get started on Node1


After killing MS2 server on Node2



It starts up on Node1: