Thursday, 21 December 2017

WebLogic Server 12cR1 (12.1.2 and 12.1.3) : Clustered Domains

This article describes how to create a two-node clustered domain using Oracle WebLogic 12cR1 (12.1.2 and 12.1.3).

◉ Install WebLogic 12cR1 (12.1.2)


Make sure both machines have WebLogic 12cR1 (12.1.2 or 12.1.3) installed. An example of these installations can be found here:

◈ Oracle WebLogic Server (WLS) 12cR1 (12.1.2) Installation on Oracle Linux 5 and 6
◈ Oracle WebLogic Server (WLS) 12cR1 (12.1.3) Installation on Oracle Linux 5 and 6

The example here also includes the ADF Application Developer Runtime. If you plan on building a clustered domain for deployment of ADF applications, you will also need to configure the following before moving on.

◈ WebLogic Server 12c : ADF Application Development Runtime Installation on Oracle Linux
◈ WebLogic Server 12c : ADF Application Development Runtime - Repository Configuration Utility (RCU)

Once the installation is complete on both machines, come back to this article to create the clustered domain.

◉ Create the Clustered Domain


The details of the cluster being built in this article are as follows.

Machines        : wls12cr2-1.localdomain,
                  wls12cr2-2.localdomain

Domain Name     : clusterDomain


Managed Servers : AdminServer     - Running on wls12cr2-1.localdomain
                  clusterServer_1 - Running on wls12cr2-1.localdomain
                  clusterServer_2 - Running on wls12cr2-2.localdomain

Cluster         : cluster_1

Creation of a clustered domain can be done from the administration console, the command line or the configuration wizard. In my opinion, using the configuration wizard is the quickest way to get the job done. Start the configuration wizard.

$ $WLS_HOME/common/bin/config.sh

Accept the "Create a new WebLogic domain" option and enter the domain location, including the domain name at the end of the location. In this case I used "/u01/app/oracle/config/domains/clusterDomain". Click the the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Select the product templates the domain requires and click the "Next" button. Depending on the options you pick, a number of additional steps may be included.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Enter the application location, including the domain name in the path, and click the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Enter the administor account credentials and click the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Enter the domain mode and JDK, then click the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Select the "RCU Data" option and enter the database details. Click the "Get RCU Configuration" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Once the details are retrieved, click the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Accept the component datasources by clicking the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Once the JDBC tests have completed successfully, click the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Select the advanced configuraton options you require and click the "Next" button. For this example I checked the first three options. Depending on the options you pick, extra steps may be added.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Enter the administration server details and click the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Select the type of node manager you require and enter the credentials. Click the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Add the managed servers for the domain, making sure the listen address is referring to the appropriate machine for each. When you are finished, click the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Add a cluster entry, remember to add the appropriate cluster address. This can be a comma-separated list of "IP/DNS_Name:port" for the managed servers, a DNS name that maps to multiple IP addresses or the local machine if all servers run on one machine. Click the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Associate the managed servers with the cluster and click the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Accept the Coherence Cluster setting by clicking the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Click the "Unix Machine" tab and add the machines used by the cluster. I've used the fully qualified machine names in all cases. Click the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Assign the managed servers to the machines in the cluster and click the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

If you are happy with the summary information, click the "Create" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Once the configuration is complete click the "Next" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

Make a note of the Admin Server URL and click the "Finish" button.

WebLogic Server 12cR1, Clustered Domains, Oracle Database Certifications

◉ Start Node Manager and Domain on First Machine


If the node manager is not already started on the first server, start it now.

$ export DOMAIN_HOME=$ORACLE_BASE/config/domains/clusterDomain
$ nohup $DOMAIN_HOME/bin/startNodeManager.sh &

Start the new domain on the first machine.

$ $DOMAIN_HOME/startWebLogic.sh

This second command will keep hold of the session. That is a good thing right now. Wait for the "RUNNING" state before proceeding.

It may seem odd that you are starting the AdminServer in the new domain, then immediately stopping it in the next section (assuming you do not reset the node manager password), but some of the configuration is not written to the file system until the AdminServer is started for the first time, so don't skip this step.

◉ Create a Boot Identity File


Create a boot identity file for the domain.

$ export DOMAIN_HOME=$ORACLE_BASE/config/domains/clusterDomain
$ mkdir -p $DOMAIN_HOME/servers/AdminServer/security
$ echo "username=weblogic" > $DOMAIN_HOME/servers/AdminServer/security/boot.properties
$ echo "password=Password1" >> $DOMAIN_HOME/servers/AdminServer/security/boot.properties

◉ Transfer Domain to Second Machine


On the first machine, stop the newly created domain. The easiest way to do this is to go into the session that is currently running it and issue "CTRL+C".

We will transfer the relevant configuration using the pack and unpack utilities.

On the first machine, pack the domain configuration using the following commands. Remember to amend the DOMAIN_HOME environment variable and the -template_name parameter to match your domain.

$ export DOMAIN_HOME=$ORACLE_BASE/config/domains/clusterDomain
$ cd $WL_HOME/common/bin
$ ./pack.sh -managed=true -domain=$DOMAIN_HOME -template=${DOMAIN_HOME}-template.jar -template_name=clusterDomain

Copy the resulting jar file to the second machine.

$ scp ${DOMAIN_HOME}-template.jar oracle@wls12cr2-2.localdomain:/u01/app/oracle/config/domains

Unpack the configuration on the second machine. Remember to amend the DOMAIN_HOME environment variable to match your domain.

$ export DOMAIN_HOME=$ORACLE_BASE/config/domains/clusterDomain
$ cd $WL_HOME/common/bin
$ ./unpack.sh -domain=$DOMAIN_HOME -template=${DOMAIN_HOME}-template.jar

Restart the domain on the first machine. Wait until it is fully started before continuing.

$ $DOMAIN_HOME/startWebLogic.sh

◉ Enroll Second Machine


On the second machine, start WLST.

$ $WLS_HOME/common/bin/wlst.sh

Connect to the administration server manager on the first machine, enroll the current machine, disconnect and exit WLST.

connect('weblogic', 'Password1', 't3://wls12cr2-1.localdomain:7001')

nmEnroll('/u01/app/oracle/config/domains/clusterDomain', '/u01/app/oracle/config/domains/clusterDomain/nodemanager')

disconnect()
exit()

Check the "$MW_HOME/domain-registry.xml" file contains an entry like the following. If it doesn't, add it manually.

<domain location="/u01/app/oracle/config/domains/clusterDomain"/>

Check the "$DOMAIN_HOME/nodemanager/nodemanager.domains" file contains an entry like the following. If it doesn't, add it manually.

clusterDomain=/u01/app/oracle/config/domains/clusterDomain

If the node manager is not already started on this server, start it now.

$ nohup $DOMAIN_HOME/bin/startNodeManager.sh &

◉ Check Node Manager on Each Machine


Check the node manager is reachable on each machine.

◈ Log in to the administration server (http://wls12cr2-1.localdomain:7001/console).
◈ In the "Domain Structure" tree, expand the "Environment" node and click on the "Machines" node.
◈ In the right-hand pane, click on the first machine (wls11g-1.localdomain).
◈ Click on the "Monitoring" tab. Be patient. This may take a little time the first time you do it.
◈ If the status is "Reachable", everything is fine.
◈ Repeat for the second machines (wls12cr2-2.localdomain).

◉ Start Up

Provided the node manager is up on all servers, you can now start/stop the managed servers on both machines from the command line. The following example shows how you might do this.

$ # Start on each server.
$ nohup $WLS_HOME/server/bin/startNodeManager.sh > /dev/null 2>&1 &

$ # Start the managed servers from any server.
$ # Requires boot identity file for this to work as a background process.
$ nohup $DOMAIN_HOME/startWebLogic.sh > /dev/null 2>&1 &
$ nohup $DOMAIN_HOME/bin/startManagedWebLogic.sh clusterServer_1 > /dev/null 2>&1 &
$ nohup $DOMAIN_HOME/bin/startManagedWebLogic.sh clusterServer_2 > /dev/null 2>&1 &

Provided the administration server is available, you can manage the other managed servers from the console.