11 Creating Dynamic Clusters

This chapter describes how to create dynamic clusters.

This chapter includes the following sections:

What Are Dynamic Clusters and Why Use Them?

A dynamic cluster is any cluster that contains one or more dynamic servers. Dynamic clusters are based on a single, shared server template. You use the shared server template to specify the configuration of the servers in your dynamic cluster so that each server does not need to be manually configured when expanding the cluster. See "Server Templates" in Understanding Domain Configuration for Oracle WebLogic Server.

Dynamic clusters enable you to easily increase the number of server instances in your domain. When configuring your dynamic cluster, you can specify the number of server instances you anticipate needing at peak load. WebLogic Server will create the specified number of server instances and apply the calculated attribute values to each one. When you need additional server capacity, you can then start a server instance without having to first manually configure the server instance and add it to the cluster. For more information about configuring dynamic clusters, see "Create dynamic clusters" in the Oracle WebLogic Server Administration Console Online Help. For information on design and deployment best practices when creating a cluster, see "Clustering Best Practices."

Defining Calculated Attribute Values in Dynamic Clusters

When you use a server template to create a dynamic cluster and specify the number of server instances you want, WebLogic Server calculates and then uses the calculated values for these attributes:

  • Server name

  • (Optional) Listen ports (clear text and SSL)

  • (Optional) Machines or virtual machines

  • (Optional) Network access point listen ports

Calculating Server Names

The calculated server name is controlled by the ServerNamePrefix attribute. Server names are the specified prefix followed by the index number. For example, if the prefix is set to dyn-server-, then the dynamic servers will have the names dyn-server-1, dyn-server-2, and so on for the number of server instances you specified.

Calculating Listen Ports

The settings in the server template and the dynamic cluster configuration determine the listen ports for the server instances in your dynamic cluster. For more information about these settings, see "Create dynamic clusters" in the Oracle WebLogic Server Administration Console Online Help. WebLogic Server calculates listen ports by default, but this calculation can also be disabled in the dynamic cluster configuration. Listen port settings are controlled by the CalculatedListenPorts attribute.

If you explicitly define a listen port for your dynamic cluster in the server template or the cluster configuration itself, that value will be used for the first generated server instance and appended by 1 for each additional server instance. If the default listen port is indicated, WebLogic Server increments the "hundreds" digit by one and continue from there. Table 11-1 shows examples of calculated listen port values.

Table 11-1 Calculating Listen Ports

Listen Port Type Configuration Setting in Server Template Dynamic Server Listen Port Values

Server listen port

Listen port not set

dyn-server-1: 7101

dyn-server-2: 7102

...

Server listen port

Listen port set to 7300

dyn-server-1: 7301

dyn-server-2: 7302

...

Server SSL listen port

SSL listen port not set

dyn-server-1: 8101

dyn-server-2: 8102

...

Server SSL listen port

SSL listen port set to 8200

dyn-server-1: 8201

dyn-server-2: 8202

...

Server network access point listen port

Network access point listen port not set

dyn-server-1: 9101

dyn-server-2: 9102

...

Server network access point listen port

Network access point listen port set to 9200

dyn-server-1: 9201

dyn-server-2: 9202

...

Server replication ports

Replication ports set to 8100

dyn-server-1: 8100

dyn-server-2: 8101

...

Server replication ports

Replication ports set to 8100-8104

dyn-server-1: 8100-8104

dyn-server-2: 8105-8109

dyn-server-3: 8110-8114

...


Listen ports can also be overridden at server startup using system properties. For example:

To override the listen port:

-Dweblogic.ListenPort=7305

To override the SSL listen port:

-Dweblogic.ssl.ListenPort=7403

To override the listen port of the network access point named mynap:

-Dweblogic.networkaccesspoint.mynap.ListenPort=8201

Calculating Machine Names

The dynamic cluster CalculatedMachineNames and MachineNameMatchExpression attributes control how server instances in a dynamic cluster are assigned to a machine. If the CalculatedMachineNames attribute is set to false, then the dynamic servers will not be assigned to a machine. If the CalculatedMachineNames attribute is set to true, then the MachineNameMatchExpression attribute is used to select the set of machines used for the dynamic servers. If the MachineNameMatchExpression attribute is not set, then all of the machines in the domain are selected. Assignments are made using a round robin algorithm. Table 11-2 shows examples of machine assignments in a dynamic cluster.

Table 11-2 Calculating Machine Names

Machines in Domain MachineNameMatchExpression Configuration Dynamic Server Machine Assignments

M1, M2

Not set

dyn-server-1: M1

dyn-server-2: M2

dyn-server-3: M1

...

Ma1, Ma2, Mb1, Mb2

Ma1, Mb*

dyn-server-1: Ma1

dyn-server-2: Mb1

dyn-server-3: Mb2

dyn-server-4: Ma1

...


Creating Dynamic Clusters Example

This section describes how to create a dynamic cluster using WebLogic Scripting Tool (WLST):

  1. Create a server template and specify the desired server attributes in the server template.

  2. Create a dynamic cluster and specify the desired cluster attributes.

  3. Set the server template for your dynamic cluster.

  4. Set the maximum number of server instances allowed in your dynamic cluster.

  5. Using your preferred WebLogic Server method, start and stop the servers in your dynamic cluster.

Note:

When creating a dynamic cluster in the Administration Console, WebLogic Server creates the server template, dynamic cluster, and specified number of server instances for you. You do not have to create them individually.

For more information about creating dynamic clusters using the Administration Console, see "Create dynamic clusters" in the Oracle WebLogic Server Administration Console Online Help.

The following example demonstrates using WLST to create a dynamic cluster. The example includes inline comments.

#
# This example demonstrates the WLST commands needed to create a dynamic cluster
# (dynamic-cluster). The dynamic cluster utilizes a server template     
# dynamic-cluster-server-template. To keep this example simple, error handling
# was omitted.
#
connect()
edit()
startEdit()
#
# Create the server template for the dynamic servers and set the attributes for
# the dynamic servers. Setting the cluster is not required.
#
dynamicServerTemplate=cmo.createServerTemplate("dynamic-cluster-server-template")
dynamicServerTemplate.setAcceptBacklog(2000)
dynamicServerTemplate.setAutoRestart(true)
dynamicServerTemplate.setRestartMax(10)
dynamicServerTemplate.setStartupTimeout(600)
#
# Create the dynamic cluster and set the dynamic servers.
#
dynCluster=cmo.createCluster("dynamic-cluster")
dynServers=dynCluster.getDynamicServers()
dynServers.setMaximumDynamicServerCount(10)
dynServers.setServerTemplate(dynamicServerTemplate)
#
# Dynamic server names will be dynamic-server-1, dynamic-server-2, ...,
# dynamic-server-10.
#
dynServers.setServerNamePrefix("dynamic-server-")
#
# Listen ports and machines assignments will be calculated. Using a round-robin
# algorithm, servers will be assigned to machines with names that start with
# dyn-machine.
#
dynServers.setCalculatedMachineNames(true)
dynServers.setMachineNameMatchExpression("dyn-machine*")
#
# activate the changes
#
activate()

The resulting config.xml file is:

<server-template> 
    <name>dynamic-cluster-server-template</name>
    <accept-backlog>2000</accept-backlog>
    <auto-restart>true</auto-restart>
    <restart-max>10</restart-max>
    <startup-timeout>600</startup-timeout>
</server-template>

<cluster>
    <name>dynamic-cluster</name>
    <dynamic-servers>
      <server-template>dynamic-cluster-server-template</server-template>
      <maximum-dynamic-server-count>10</maximum-dynamic-server-count>
      <calculated-machine-names>true</calculated-machine-names>
      <machine-name-match-expression>dyn-machine*</machine-name-match-expression>
      <server-name-prefix>dynamic-server-</server-name-prefix>
    </dynamic-servers>
</cluster>

Starting Dynamic Clusters

You can start dynamic clusters in the same way you start non-dynamic clusters, using a start script, the Administration Console, WLST, or Node Manager. You specify the calculated name of the server when starting the server. For more information about the calculated server name, see "Calculating Server Names."

Before you begin, ensure that WebLogic Server is installed on all of the hosts where you want to run your server instances. If you want to use Node Manager to start and stop your server instances, then you must also run Node Manager on these hosts.

If you want to use Node Manager to start the server instances in your dynamic cluster and if you want to automatically map these server instances to machines, then you must configure the machines before you configure your dynamic cluster. See "Create and configure machines" in the Oracle WebLogic Server Administration Console Online Help.

There may be several other procedures you must follow before you can start server instances in your cluster, based on the method you choose to manage server startup and what startup tasks you have already performed. See "Starting Servers: Before You Begin" in Administering Server Startup and Shutdown for Oracle WebLogic Server.

For more information about starting a cluster using Node Manager and WLST, see "Using Node Manager to Start Managed Servers in a WebLogic Domain or Cluster" in Understanding the WebLogic Scripting Tool.

For more information about starting Managed Servers in a cluster using a startup script, see "Starting Managed Servers with a Startup Script" in Administering Server Startup and Shutdown for Oracle WebLogic Server. If you use startup scripts to start and stop server instances, then you can use the pack and unpack commands to extend the domain to the hosts where you want to run your server instances. You can then use the startManagedWebLogic start script and specify the name of the server instance you want to start.

Deploying Applications to Dynamic Clusters

You can deploy applications to dynamic clusters by following the same process as deploying applications to clusters with nondynamic servers. For more information about deploying applications to a cluster, see "Deploy Applications" and "Application Deployment for Clustered Configurations."

For a broad discussion of deployment topics, see Deploying Applications to Oracle WebLogic Server.

Note:

You cannot target an application to an individual dynamic server. You must target applications to a cluster and any dynamic servers in the cluster will then deploy the applications.

Limitations and Considerations When Using Dynamic Clusters

Whole server migration and service migration are not supported for use with dynamic clusters.

Dynamic clusters do not support targeting to an individual dynamic server instance; therefore, the following cannot be used with dynamic clusters:

  • Deployments that cannot target to a cluster. This includes migratable targets.

  • Configuration attributes that refer to individual servers. This includes JTA migratable targets, constrained candidate servers, user preferred server, all candidate servers, and hosting server.

  • Configuration attributes that are server-specific. This includes replication groups, preferred secondary groups, and candidate machines (server level).

There are also JMS limitations on dynamic clusters. For more information, see "Simplified JMS Cluster Configuration" in Administering JMS Resources for Oracle WebLogic Server.