venerdì 21 ottobre 2016

How to create a WebLogic Cluster on two different Machines

Suppose that you have two different Hardware (or Virtual) Machines:

Machine_A and Machine_B

To create a WebLogic Horizontal Cluster on these Machines you have to do:

--- [01] ---
Verify that there are no limitation on the LAN between the 2 Machines, you must be able to ping Machine_B from Machine_A and Machine_A from Machine_B.

Verify also that there in not an active firewall.

For example on Linux:

service firewalld stop 
(stop the firewall if it is active)

 systemctl disable firewalld  
(to permanently disable the firewall)

Verify that DATE & TIME are the same on both Machines
Verify that on Machine_A and Machine_B it is installed the same version of JDK
Verify that you are using the same version of OS with the same patches level on both Machines

--- [02] ---
Install the same version of WLS software on both Machines, it is suggested to install WLS under the same PATH on the 2 Machines:

For examples I have installed WLS in :

Machine_A:
c:\FABRIZIO\demo_wls  

Machine_B:
c:\FABRIZIO\demo_wls  

--- [03] ---
Create a Domain with Admin Server on Machine_A.
(In my example I have created a "base_domain" with an AdminServer on port 7001)

To do this you can execute the command:
c:\FABRIZIO\demo_wls\oracle_common\common\bin\config.cmd  

--- [04] ---
Start the Admin Server:
c:\FABRIZIO\demo_wls\user_projects\domains\base_domain\startWebLogic.cmd 

Open the WLS Console:
 http://IP_Machine_A:7001/console

Create a Cluster with 2 Managed Server (ManagedServer_on_A , ManagedServer_on_B)
(If you prefer you can create the cluster during the creation of the domain)

--- [05] ---
Stop the AdminServer and verify that there are no Active Servers and no JVM running in your Domain.

Now we must create a compressed copy of the Domain ("base_domain") that you have created on Machine_A, transfer and uncompress  it on Machine_B.

To do this you must:

Execute the PACK command on Machine_A with the following parameters:
c:\FABRIZIO\demo_wls\oracle_common\common\bin\pack.cmd  
 -managed=true  
 -domain=c:\FABRIZIO\demo_wls\user_projects\domains\base_domain  
 -template=c:\FABRIZIO\demo_wls\user_projects\domains\basedomain_managed.jar  
 -template_name="MyBaseDomain"  

The complete command is:
pack -managed=true -domain=c:\FABRIZIO\demo_wls\user_projects\domains\base_domain -template=c:\FABRIZIO\demo_wls\user_projects\domains\basedomain_managed.jar -template_name="MyBaseDomain" 

The result of this command is the creation of the file:
basedomain_managed.jar
under the directory on Machine_A:
c:\FABRIZIO\demo_wls\user_projects\domains

Now transfer the file basedomain_managed.jar on Machine_B under the directory:
c:\FABRIZIO\demo_wls\user_projects\domains
(you need to create the directories "user_projects" and "domains")

Execute the UNPACK command on Machine_B with the following parameters:
c:\FABRIZIO\demo_wls\oracle_common\common\bin\unpack.cmd  
 -domain=c:\FABRIZIO\demo_wls\user_projects\domains\base_domain  
 -template=c:\FABRIZIO\demo_wls\user_projects\domains\basedomain_managed.jar  

The complete command is:
unpack -domain=c:\FABRIZIO\demo_wls\user_projects\domains\base_domain -template=c:\FABRIZIO\demo_wls\user_projects\domains\basedomain_managed.jar  

The result of this command is the creation, on Machine_B, of a new Domain (in my case "base_domain") under the directory
c:\FABRIZIO\demo_wls\user_projects\domains

--- [06] ---
Start AdminServer on Machine_A:
c:\FABRIZIO\demo_wls\user_projects\domains\base_domain\startWebLogic.cmd  

Wait until AdminServer is Running.

Now we must start the 2 Managed Servers of the Cluster with the command:
startManagedWebLogic.cmd SERVER_NAME {ADMIN_URL}  


Start ManagedServer_on_A on Machine_A, to do this execute the command:
c:\FABRIZIO\demo_wls\user_projects\domains\base_domain\bin\startManagedWebLogic.cmd ManagedServer_on_A http://IP_Machine_A:7001

Start ManagedServer_on_B on Machine_B, to do this execute the command:
c:\FABRIZIO\demo_wls\user_projects\domains\base_domain\bin\startManagedWebLogic.cmd ManagedServer_on_B http://IP_Machine_A:7001  

--- [07] ---
This is a procedure valid for all the versions of WLS, but starting from WLS 12.1.2, you do not need to execute the nmEnroll() command on WLST  to enroll the node manager:

https://blogs.oracle.com/WebLogicServer/entry/new_node_manager_configuration_model
  • When you use the “pack” command with the “-managed=true” option, the configuration framework includes changes to the nodemanager.properties file in the template file.
  • When you use the “unpack” command on the remote host where you want to run your Managed Servers, the configuration framework sets up the domain, regenerates the nodemanager.properties file, generates a nodemanager.domains file (no need to run nmEnroll!), generates a DemoIdentity.jks keystore, and generates a startNodeManager script.

1 commento: