adds an existing cluster or server instance to an existing load balancer
configuration or load balancer
asadmin [asadmin-options] create-http-lb-ref [--help]
--config config_name | --lbname load_balancer_name
[--lbpolicy round-robin] [--lbpolicymodule lb_policy_module]
[--healthcheckerurl url] [--healthcheckerinterval 10]
[--healthcheckertimeout 10] [--lbenableallinstances=true]
[--lbenableallapplications=true] [--lbweight instance=weight[:instance=weight]*]
target
Use the create-http-lb-ref
subcommand to:
-
Add an existing cluster or server instance to an existing load
balancer configuration or load balancer. The load balancer forwards the
requests to the clustered and standalone instances it references.
-
Set the load balancing policy to round-robin, weighted round-robin, or
to a user-defined policy.
-
Configure a health checker for the load balancer. Any health checker
settings defined here apply only to the target. If you do not create a
health checker with this subcommand, use create-http-health-checker
.
-
Enable all instances in the target cluster for load balancing, or use
enable-http-lb-server
to enable them individually.
-
Enable all applications deployed to the target for load balancing, or
use enable-http-lb-application
to enable them individually.
Note
|
This subcommand is only applicable to Oracle GlassFish Server. This
subcommand is not applicable to GlassFish Server Open Source Edition.
|
- asadmin-options
-
Options for the asadmin
utility. For information about these
options, see the asadmin
(1M) help page.
--help
-?
-
Displays the help text for the subcommand.
--config
-
Specifies which load balancer configuration to which to add clusters
and server instances. Specify either a load balancer configuration or
a load balancer. Specifying both results in an error.
--lbname
-
Specifies the load balancer to which to add clusters and server
instances. Specify either a load balancer configuration or a load
balancer. Specifying both results in an error.
--lbpolicy
-
The policy the load balancer follows. Valid values are round-robin
,
weighted-round-robin
, and user-defined
. If you choose
user-defined, specify a load balancer policy module with the
lbpolicymodule
option. If you choose weighted-round-robin
assign
weights to the server instances using the configure-lb-weight
subcommand. The default is round-robin
.
--lbpolicymodule
-
If your load balancer policy is user-defined
, use this option to
specify the full path and name of the shared library of your load
balancing policy module. The shared library needs to be in a location
accessible by the web server.
--healthcheckerurl
-
The URL to ping to determine whether the instance is healthy.
--healthcheckerinterval
-
The interval in seconds the health checker waits between checks of an
unhealthy instance to see whether it has become healthy. The default
value is 30 seconds. A value of 0 disables the health checker.
--healthcheckertimeout
-
The interval in seconds the health checker waits to receive a response
from an instance. If the health checker has not received a response in
this interval, the instance is considered unhealthy. The default is
10.
--lbenableallinstances
-
Enables all instances in the target cluster for load balancing. If the
target is a server instance, enables that instance for load balancing.
The default value is true.
--lbenableallapplications
-
Enables all applications deployed to the target cluster or instance
for load balancing. The default value is true.
--lbweight
-
The name of the instance and the weight you are assigning it. The
weight must be an integer. The pairs of instances and weights are
separated by colons. For example instance1=1:instance2=4
means that
for every five requests, one goes to instance1 and four go to
instance2. A weight of 1 is the default.
- target
-
Specifies which cluster or instance to add to the load balancer. Valid
values are:
-
cluster_name- Specifies that requests for this cluster will be
handled by the load balancer.
-
stand-alone_instance_name- Specifies that requests for this
standalone instance will be handled by the load balancer.
Example 1 Adding a Cluster Reference to a Load Balancer Configuration
This example adds a reference to a cluster named cluster2
to a load
balancer configuration named mylbconfig
.
asadmin> create-http-lb-ref --config mylbconfig cluster2
Command create-http-lb-ref executed successfully.
Example 2 Adding a Cluster Reference to a Load Balancer
This example adds a reference to a cluster named cluster2
to a load
balancer named mylb
.
asadmin> create-http-lb-ref --lbname mylb cluster2
Command create-http-lb-ref executed successfully.
Example 3 Configuring a Health Checker and Load Balancer Policy
This example configures a health checker and load balancing policy, and
enables the load balancer for instances and applications.
asadmin> create-http-lb-ref --config mylbconfig --lbpolicy weighted-round-robin
--healthcheckerinterval 40 --healthcheckertimeout 20
--lbenableallinstances=true --lbenableallapplications=true cluster2
Command create-http-lb-ref executed successfully.
Example 4 Setting a User-Defined Load Balancing Policy
This example sets a user-defined load balancing policy.
asadmin> create-http-lb-ref --lbpolicy user-defined --lbpolicymodule /user/modules/module.so
--config mylbconfig cluster2
Command create-http-lb-ref executed successfully.
- 0
-
subcommand executed successfully
- 1
-
error in executing the subcommand