WebLogic Cluster on same machine (12C)

Home/WebLogic/WebLogic Cluster on same machine (12C)

WebLogic Cluster on the same machine

WebLogic cluster has more than one WebLogic Server running parallel to solve server failovers and provide scalability. Depends on the machine performance like CPU speed, processors, memory and hard disk space, we could add, delete and stop the WebLogic server instance in a cluster while it is running. A cluster is part of a WebLogic domain.

WebLogic provides a web utility called ‘Console’ for a domain. Through the console, Administrator can create, manage and monitor WebLogic cluster, server, and other parameters through a browser. Here I have mentioned ‘Administrator,’ yes, it is a role in WebLogic which can be assigned to a user to become Administrator. Let’s talk about the two main feature of WebLogic cluster, i.e., Failover and stability.

Failover: –

For example, we deployed a web application (war file) on a single WebLogic Server instance. Due to power failure, CPU overload or system crash the server shuts down and stops the web application. Because of that, the application is unavailable to the user. If we deploy the same web application on multiple servers which is in a cluster and if one server goes down, then the application is taken care by remaining running server instances in the cluster. It solves the issue of failovers if any server failed then the remaining running servers in the cluster takes care of the application. The same way we could cluster JMS, JMX data sources, etc.

Stability:

For example; a web application is deployed on a WebLogic server instance, and 100 users are accessing the application concurrently. The machine where the server is running is capable of handling 150 concurrent users at max. Due to some demand, around 300 users starts using the application at the same time which leads to poor performance. So adding an extra server in the cluster is required to handle the 300 user requests and it will resolve this issue. WebLogic administrator can add or remove server instances without interrupting the service depends on demand.

There are other main features that are part of the cluster are called Session Replication, Load Balancing, Migratable targets which I will cover in my upcoming blog posts. This section we’ve described creating and running WebLogic cluster and deploy a sample web application on the cluster in Windows.

Pre-Requisite:

WebLogic should be installed ( WebLogic 12C installation instruction)


WebLogic Cluster

Go to <WEBLOGIC_HOME> > common > bin . Double click on the config.cmd file to create a domain (It is config.sh for Linux)

Note: Weblogic_Home is a directory where all the WebLogic software binaries will reside. It usually in <WEBLOGIC_HOME>\wlserver

091316_0647_WebLogicClu1 WebLogic Cluster on same machine (12C)

It opens a config wizard; Input a domain name. A domain consists of cluster, server instances with one AdminServer. The WebLogic console will be deployed on the AdminServer where a user can manage and control server instances. The domain will be created in a location as mentioned here. This is called <DOMAIN_HOME>

091316_0647_WebLogicClu2 WebLogic Cluster on same machine (12C)

Accept default and click next.

091316_0647_WebLogicClu3 WebLogic Cluster on same machine (12C)

Input WebLogic username and password. Save the credentials in a secret location. This is required to log in to WebLogic console.

091316_0647_WebLogicClu4 WebLogic Cluster on same machine (12C)

Choose the Development mode so that WebLogic won’t ask for credentials during the startup

Note:

If we choose the Development mode, the WebLogic username and password will be stored in a file boot.properties under <DOMAIN_HOME>\servers\Adminserver\security. The password will be encrypted automatically by the WebLogic server, and it uses this file for authentication during the startup.

091316_0647_WebLogicClu5 WebLogic Cluster on same machine (12C)

Enable all the check boxes and click Next. We will cover each one shortly

091316_0647_WebLogicClu6 WebLogic Cluster on same machine (12C)

Default the Admin server will be running on 7001. Change the port if required. The WebLogic console will be deployed in the AdminServer. The URL of  console is http://localhost:7001/console

If SSL is enabled and port is specified,  User could access the console with SSL support. For example, https://localhost:port/console

091316_0647_WebLogicClu7 WebLogic Cluster on same machine (12C)

Enable ‘Manual Node Manager Setup and click Next. Node Manager is a Java utility running as a separate process. Using Nodemanager, a user can control the domain remotely. For example, we could start, stop a WebLogic managed server remotely

If credentials are provided in this screen, then node manager asks for username and password during the startup

091316_0647_WebLogicClu8 WebLogic Cluster on same machine (12C)

This screen we add WebLogic Server instances for a cluster. Using the Add button, add WebLogic servers. I have added here two managed servers with port 7003 & 7004.

Note: All servers other than admin server are called <MANAGED SERVER>

Two managed servers are creating here; they are accessed by http://localhost:7003 and http://localhost:7004 .

091316_0647_WebLogicClu9 WebLogic Cluster on same machine (12C)

This screen, we will add the cluster. Using the Add button, create a cluster

091316_0647_WebLogicClu10 WebLogic Cluster on same machine (12C)

Move the managed servers we’ve created earlier to the cluster as shown below. Here we are adding the managed servers to cluster

091316_0647_WebLogicClu11 WebLogic Cluster on same machine (12C)

A machine is a logical name of the computer where the WebLogic server instances are running. The default port is 5556 that can be updatable on this screen. It is

091316_0647_WebLogicClu12 WebLogic Cluster on same machine (12C)

Add the servers to the machine; now these servers are controlled remotely through node manager

091316_0647_WebLogicClu13 WebLogic Cluster on same machine (12C)

Click Next to Virtual Targets

091316_0647_WebLogicClu14 WebLogic Cluster on same machine (12C)

Click Next to Partitions

091316_0647_WebLogicClu15 WebLogic Cluster on same machine (12C)

Review the summary and click Create

091316_0647_WebLogicClu16 WebLogic Cluster on same machine (12C)

Click Next

091316_0647_WebLogicClu17 WebLogic Cluster on same machine (12C)

Click Finish

091316_0647_WebLogicClu18 WebLogic Cluster on same machine (12C)

So far we have created a WebLogic domain with the cluster, a machine, and two managed servers. Now we need to start the NodeManager, AdminServer, and Managed servers

Start AdminServer

Open another command prompt and go to the bin directory again. Run startWebLogic.cmd . This will start the AdminServer

Because of we chose the domain as development mode. The server won’t ask for WebLogic username and password. If you choose production mode, then input the WebLogic username and Password that mentioned in screen four from top of the page

091316_0647_WebLogicClu19 WebLogic Cluster on same machine (12C)

Once the WebLogic completes running. The output shows similar like below

091316_0647_WebLogicClu20 WebLogic Cluster on same machine (12C)

 

 

Register WebLogic domain with NodeManager

  1. Open a command prompt and go to the WEBLOGIC_HOME/server/bin
  2. Run setWLSEnv.cmd as shown below

091316_0647_WebLogicClu21 WebLogic Cluster on same machine (12C)

  3. Enter the following command in the terminal window. (If Java is not in the windows path, the below command will not run)

 

091316_0647_WebLogicClu22 WebLogic Cluster on same machine (12C)

4. Connect to the WebLogic admin console by entering the following command

Where,

USERNAME = WebLogic username,

password w= WebLogic password,

Hostname =server name where WebLogic is running,

Port = WebLogic admin server port

For example: connect(‘WebLogic’, ‘weblogic123’, ‘t3://localhost:7001’)

091316_0647_WebLogicClu23 WebLogic Cluster on same machine (12C)

5. Use the nmEnroll command to enroll the WebLogic domain. The nmEnroll requires two arguments where

a) The domain directory

b) The Node Manager home directory

Example:

 

091316_0647_WebLogicClu24 WebLogic Cluster on same machine (12C)

6. Input exit() to exit the node manager

 

091316_0647_WebLogicClu25 WebLogic Cluster on same machine (12C)

 

 

Start Node Manager:

Open a command prompt > Go to the domain directory have created earlier > Go to the bin > Run the setDomainEnv.cmd

The domain directory is under <MIDDLEWARE_HOME>\user_projects\domains\<DOMAIN_NAME>\bin

091316_0647_WebLogicClu26 WebLogic Cluster on same machine (12C)

Go to the bin directory again and run the startNodemanager.cmd as shown below

091316_0647_WebLogicClu27 WebLogic Cluster on same machine (12C)

Allow access if it prompts. Once it finished running, the output will be like below

091316_0647_WebLogicClu28 WebLogic Cluster on same machine (12C)

 

 

Start Managed Servers

Now time to start Managed Servers in a cluster. Open a browser and go to the URL http://localhost:7001/console . Input the WebLogic username and password and click login

091316_0647_WebLogicClu29 WebLogic Cluster on same machine (12C)

Expand Environment and Click on the servers on the WebLogic home page. Here you see the AdminServer and managed servers.

The AdminServer is in running mode, and managed servers are in shutdown mode

091316_0647_WebLogicClu30 WebLogic Cluster on same machine (12C)

Click on the control tab > Select the managed servers > Click start

A green text appears on the top and say it started the selected servers

091316_0647_WebLogicClu31 WebLogic Cluster on same machine (12C)

Refresh the browser after few minutes; the server will change in to Running state

091316_0647_WebLogicClu32 WebLogic Cluster on same machine (12C)

Deploy a war file

Download the sample Web application from webapp. Unzip the file and you will find a webapp.war file.

 

On the Weblogic console, Click on the Deployment > Click Install

091316_0647_WebLogicClu33 WebLogic Cluster on same machine (12C)

Go to the directory where the war file is present > Select the war file > Click Next

091316_0647_WebLogicClu34 WebLogic Cluster on same machine (12C)

Click Next

091316_0647_WebLogicClu35 WebLogic Cluster on same machine (12C)

Select the cluster and click Next

Y091316_0647_WebLogicClu36 WebLogic Cluster on same machine (12C)

Click Finish

091316_0647_WebLogicClu37 WebLogic Cluster on same machine (12C)

The webApp active state indicates it is in running mode

091316_0647_WebLogicClu38 WebLogic Cluster on same machine (12C)

Run the application from the two managed servers.

http://localhost:7003/webapp

http://localhost:7004/webapp

The webapp will display the page like below

091316_0647_WebLogicClu39 WebLogic Cluster on same machine (12C)

Hey wait, Am I going to access the deployed web application in different URL’s even its clustered? The answer is NO; Using load balance, a user would know only one URL to access the application; I’ll brief this in my next post.

govindan WebLogic Cluster on same machine (12C)
Connect me

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
govindan WebLogic Cluster on same machine (12C)
Connect me
By | 2016-10-06T19:25:42+00:00 September 13th, 2016|Categories: WebLogic|Tags: , , , , |0 Comments
Like us on Facebook.
Connect!