Oracle WebLogic Server 12c Advanced Administration Cookbook
上QQ阅读APP看书,第一时间看更新

Creating a WebLogic cluster

A WebLogic cluster is normally created with the domain using the Configuration Wizard tool. The cluster can also be created and added to an existing domain by using the Administration Console. This recipe will cover adding a new cluster to the existing PROD_DOMAIN domain.

A WebLogic cluster was previously created using Configuration Wizard earlier in this book. The same cluster will be created this time, but with four Manager Server instances instead of two. So remove the original cluster before creating the new cluster.

The new cluster will be called PROD_Cluster with four WebLogic Server instances PROD_Server01, PROD_Server02, PROD_Server03, and PROD_Server04. Machine prod01 will host the instances PROD_Server01 and PROD_Server02 and machine prod02 will host the instances PROD_Server03 and PROD_Server04.

PROD_DOMAIN Topology:

PROD_DOMAIN
 |___ PROD_AdminServer
 |
 |___ PROD_Cluster
     |___ PROD_Server01
     |___ PROD_Server02
     |___ PROD_Server03
     |___ PROD_Server04

Machine distribution, WebLogic Server instances, and listen ports Topology:

Machine
 |___ prod01
 |   |_______ PROD_AdminServer (7001)
 |   |_______ PROD_Server01    (8001)
 |   |_______ PROD_Server02    (8002)
 |
 |___ prod02
     |_______ PROD_Server03    (8003)
     |_______ PROD_Server04    (8004)

Getting ready

Make sure the Administration Server is up and Node Manager is running on all machines in the domain.

If the cluster PROD_Cluster was created previously, delete it from the domain before creating the new one:

  1. Log in as a wls user to shell and start WLST:
    [wls@prod01]$ $WL_HOME/common/bin/wlst.sh 
    
  2. Connect to the Administration Server using wlsadmin as the user, <pwd> as the password and t3://prod01.domain.local:7001 as the server URL:
    wls:/offline> connect("wlsadmin","<pwd>","t3://prod01.domain.local:7001")
    
  3. Run the following WLST commands to delete the original PROD_Cluster cluster and the Managed Server instances:
    edit()
    startEdit()
    
    editService.getConfigurationManager().removeReferencesToBean(getMBean('/Clusters/PROD_Cluster'))
    
    cd('/')
    cmo.destroyCluster(getMBean('/Clusters/PROD_Cluster'))
    
    cd('/Servers/PROD_Server01')
    cmo.setCluster(None)
    cmo.setMachine(None)
    
    editService.getConfigurationManager().removeReferencesToBean(getMBean('/Servers/PROD_Server01'))
    
    cd('/')
    cmo.destroyServer(getMBean('/Servers/PROD_Server01'))
    
    cd('/Servers/PROD_Server02')
    cmo.setCluster(None)
    cmo.setMachine(None)
    
    editService.getConfigurationManager().removeReferencesToBean(getMBean('/Servers/PROD_Server02'))
    
    cd('/')
    cmo.destroyServer(getMBean('/Servers/PROD_Server02'))
    activate()
    

    The old cluster has now been removed and the new cluster is ready to be created.

How to do it...

To create the new cluster PROD_Cluster:

  1. Access Administration Console with your web browser at http://prod01.domain.local:7001/console.
  2. Click on the Lock & Edit button to start a new edit session.
  3. Expand the Environment tree on the left and click on Clusters.
  4. Click on the New button to start creating a new cluster.
  5. Type PROD_Cluster on the Name field. Leave the Messaging Mode in the Unicast mode and the rest of the parameters at their default values. Click on the OK button.
  6. The PROD_Cluster cluster will be displayed in the Clusters table list. Click on the PROD_Cluster cluster to navigate to Configuration | General. Click on the Servers tab to navigate to Configuration | Servers. Click on the Add button, as shown in the following screenshot:
  7. Type PROD_Server01 in the Server Name field and 8001 in the Listen Port field. Click on Finish.
  8. Repeat the steps to add the three remaining WebLogic Server Instances to the PROD_Cluster according to the topology: PROD_Server02 port 8002, PROD_Server03 port 8003, and PROD_Server04 port 8004.
  9. Assign the newly created Managed Server instances to their respective machines. On the navigation tree to the left, navigate to Environment | Machines and click on the prod01 machine. Now, go to Configuration | General and click on the Servers tab to go to Configuration | Servers, (as shown in the following screenshot):
  10. Click on the Select an existing server option, the and associate it with this machine radio button, select PROD_Server01 from the Select a server drop-down menu and click on the Finish button. Now do the same for PROD_Server02.
  11. Go back to the Machines page and click on the PROD_Cluster cluster to navigate to Configuration | Servers. Add the Server instances PROD_Server03 and PROD_Server04 to the prod02 machine. Click on the Finish button.
  12. Click on the Activate Changes button to finish.

How it works...

You have just created the four new WebLogic Managed Server instances, assigned them to the machines prod01 and prod02, and added them to the new cluster PROD_Cluster.

In the next few recipes, you'll configure other recommended cluster parameters, which are essential for the cluster to run properly in a production environment.

There's more...

The same cluster can also be created using the following WLST.

Creating a WebLogic cluster using WLST
  1. Log in as wls user to shell and start WLST:
    [wls@prod01]$ $WL_HOME/common/bin/wlst.sh
    
  2. Connect to the Administration Server using wlsadmin as the user, <pwd> as the password, and t3://prod01.domain.local:7001 as the server URL:
    wls:/offline> connect("wlsadmin","<pwd>","t3://prod01.domain.local:7001")
    
  3. Run the following WLST commands to create the cluster and server instances:
    edit()
    startEdit()
    
    cd('/')
    cmo.createCluster('PROD_Cluster')
    cd('/Clusters/PROD_Cluster')
    cmo.setClusterMessagingMode('unicast')
    
    cd('/')
    cmo.createServer('PROD_Server01')
    cd('/Servers/PROD_Server01')
    cmo.setListenPort(8001)
    cmo.setCluster(getMBean('/Clusters/PROD_Cluster'))
    cmo.setMachine(getMBean('/Machines/prod01'))
    
    cd('/')
    cmo.createServer('PROD_Server02')
    cd('/Servers/PROD_Server02')
    cmo.setListenPort(8002)
    cmo.setCluster(getMBean('/Clusters/PROD_Cluster'))
    cmo.setMachine(getMBean('/Machines/prod01'))
    
    cd('/')
    cmo.createServer('PROD_Server03')
    cd('/Servers/PROD_Server03')
    cmo.setListenPort(8003)
    cmo.setCluster(getMBean('/Clusters/PROD_Cluster'))
    cmo.setMachine(getMBean('/Machines/prod02'))
    
    cd('/')
    cmo.createServer('PROD_Server04')
    cd('/Servers/PROD_Server04')
    cmo.setListenPort(8004)
    cmo.setCluster(getMBean('/Clusters/PROD_Cluster'))
    cmo.setMachine(getMBean('/Machines/prod02'))
    
    activate()
    exit()
    

See also

  • Configuring HA WebLogic cluster parameters
  • Using Unicast for cluster communications
  • Using Multicast for cluster communications