Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g (10.1.3.1.0) Part Number B28221-02 |
|
|
View PDF |
To use DNS load balancing, do the following:
Within DNS, map a single host name to several IP addresses. Each of the port numbers must be the same for each IP address. Set up the DNS server to return the addresses either in a round-robin or random fashion.
The IP address identifies the OC4J running; the port number is an RMI port number.
Turn off DNS caching on the client. For UNIX machines, you must turn off DNS caching as follows:
Kill the NSCD daemon process on the client.
Start the OC4J client with the -Dsun.net.inetaddr.ttl=0
option.
Within each client, configure JNDI properties as follows (see "Using JNDI Properties"):
For java.naming.factory.initial
, use any initial context factory.
For the java.naming.provider.url
, provide single host name to which the OC4J IP addresses are mapped and the common RMI port in the form <prefix>://<hostname>:<port>/<application-name>
where <prefix>
is opmn:ormi
for OC4J in Oracle Application Server or ormi
for OC4J standalone.
Configure load balancing behavior (see "Configuring Load Balancing Behavior").
Each time the lookup occurs on the DNS server, the DNS server hands back one of the many IP addresses that are mapped to it.
For more information, see the following:
In Example 24-3, the initial context factory is RMIInitialContextFactory
(however, you can use any initial context factory for DNS load balancing), myserver
is the host name set up in the DNS server for the list of servers, and the RMI port is the default port.