| | | | Browse by category |
Contents
Starting and Stopping the Agent
Multiple Agents on a Single Machine
With multiple Hydra installations
With multiple Network Interface Cards and IP Addresses
Multiple Agents on Separate Machines
This article will describe how to configure your system so that you can run your Hydra services on multiple agents. If your use case requires the ability to start/stop services independently of each other you will need to configure your environment to use multiple agents. This is also convenient during testing of some projects.
After installing Hydra, the rwsfvars script is run to set certain environment variables that the Agent uses. One such variable is RWSF_CONF. It is by default set to the installation's conf folder. The conf folder contains a set of configuration files that the Agent loads at startup. The configuration files can be used to set properties describing how the Agent should behave.
<RWSF_HOME>/conf/rwagent.xml - configuration data needed to initialize the Agent
<RWSF_HOME>/conf/servlet/server.xml - Ajp1.3 and HTTP connectors data for accessing the servlet execution engine
<RWSF_HOME>/conf/webservice/server-transports-template.xml - server transport objects for receiving messages from the client
<RWSF_HOME>/conf/loggers.xml - configuration data for establishing the Agent log files
When running multiple agents it is necessary to avoid port conflicts. The Hydra Agent uses the following default ports
Default Ports |
Usage |
8090 |
HTTP requests sent directly to the Agent. |
8013 |
HTTP requests sent to an external Web server (for redirection to the Hydra runtime). If your external Web server uses a different port, you will want to use that port instead. |
8009 |
AJP 1.3 requests sent to the Agent; usually sent from an external Web server such as Apache. |
8443 |
HTTPS requests sent directly to the Agent |
8413 |
HTTPS requests sent to an external Web Server (for redirection to the Agent). This number should be updated to reflect the port used in your external Web Server. |
8089 |
Shutdown requests sent to the Hydra runtime. Shutdown requests must be issued from the host on which the Agent is running. |
9090 |
HTTP requests sent to a standalone client |
9443 |
HTTPS requests sent to a standalone client |
9999 |
Agent admin port |
Besides port settings, <RWSF_HOME>/conf/rwagent.xml also includes properties for directory settings. You may want to edit these directories depending on whether the multiple Agents will be sharing a resource or not. If RWSF_CONF is set differently for each agent then by default each Agent will have its own copy of many of these resources. Otherwise, the Agents may share resources unless you specifically edit the directory properties.
Examples from rwagent.xml:
<rwsf:property name="rwsf:locale-directory" value="${RWSF_CONF}/locale"/>
<rwsf:property name="rwsf:configDir" value="${RWSF_CONF}/servlet"/>
<rwsf:property name="rwsf:confDir" value="${RWSF_CONF}/agent"/>
<rwsf:property name="rwsf:webappsDir" value="${RWSF_HOME}/apps/servlets"/>
<rwsf:property name="rwsf:appsDir" value="${RWSF_HOME}/apps/services"/>
Example from loggers.xml:
<property name="filename" value="${RWSF_CONF}/logs/agent.log"/>
Starting and Stopping the Agent
The Agent uses the RWSF_CONF environment variable to determine which rwagent.xml file to use when loading. There are two ways to specify the configuration file to be used by the Agent:
- Reset RWSF_CONF prior to starting a different instance of the Agent
- Alternatively, use the rwagent -c <configuration file> command to change the configuration directory for each instance of the Agent. In Windows, using start in front of the command will open the Agent in a new console window
Use rwsfserver -c <configuration file> stop to stop a specific agent started using rwagent -c <configuration file>.
If you are using the Hydra client generated from the WSDL, the port used in the WSDL will need to match the port used to configure the agent for that service or you can edit the client to use the appropriate port.
Multiple Agents on a Single Machine
Multiple Agents can be run on one machine. For example, a development and testing environment can use this setup.
Although starting multiple Agents using one installation is possible, it is easier to configure multiple Agents to run using separate installations.
The following example illustrates how to run three instances of the Agent using three sets of port settings.
- Rename <RWSF_HOME>/conf/ to <RWSF_HOME>/conf1/
- Make two copies of <RWSF_HOME>/conf1/named <RWSF_HOME>/conf2/ and <RWSF_HOME>/conf3/.
- Edit each set of the configuration files to use different port settings.
<RWSF_HOME>/conf/ |
Port |
conf1 |
conf2 |
conf3 |
rwagent.xml |
Agent shutdown |
8089 |
8088 |
8087 |
http |
8090 |
8091 |
8092 |
|
https |
8443 |
8444 |
8445 |
|
ajp13 |
8009 |
8010 |
8011 |
|
Agent admin |
9999 |
9998 |
9997 |
|
servlet/server.xml |
http |
8090 |
8091 |
8092 |
ajp13 |
8009 |
8010 |
8011 |
|
webservice/server-transports-template.xml |
Standalone server http |
9090 |
9091 |
9092 |
Standalone server https |
9443 |
9444 |
9445 |
- Start the Agent three times using the conf directories generated above.
Open three command lines and set RWSF_CONF to point to a different conf directory in each environment. Use rwsfserver start to start the Agent as normal
or
You can use one command prompt and start the agent three times using the -c option to specify the conf directory to be used by the agent. In Windows, using start in front of the command will open the Agent in a new console window.
Agent 1
rwagent -c conf1/rwagent.xml
Agent 2
rwagent -c conf2/rwagent.xml
Agent 3
rwagent -c conf3/rwagent.xml
- Test and troubleshoot.
As mentioned above, since all three configurations use the same directory, <RWSF_HOME>/logs/agent.log, for the log file agent.log will be overwritten each time a new instance of the Agent is started. View this file after you start each Agent to confirm that it started correctly. If you want a separate log file for each Agent, edit loggers.xml and change the filename property to use a different file.
Example:
<RWSF_HOME>/conf1/loggers.xml
<property name="filename" value="${RWSF_HOME}/logs/agent1.log"/>
<RWSF_HOME>/conf2/loggers.xml
<property name="filename" value="${RWSF_HOME}/logs/agent2.log"/>
<RWSF_HOME>/conf3/loggers.xml
<property name="filename" value="${RWSF_HOME}/logs/agent3.log"/>
With Multiple Hydra installations
The setup needed to run multiple Agents on one machine using separate HydraSCA installations is similar as described above, but doesn't require making copies of the conf folder. The RWSF_HOME variable for each installation's environment is set to be the installation's directory when you run rwsfvars. However, because RWSF_HOME is an environment variable, you will need to use a new console or terminal window for each different installation.
- Edit the files in conf folder of the each of the separate installations.
<RWSF_HOME>/conf/ |
Port |
install1 |
install2 |
install3 |
rwagent.xml |
Agent shutdown |
8089 |
8088 |
8087 |
http |
8090 |
8091 |
8092 |
|
https |
8443 |
8444 |
8445 |
|
ajp13 |
8009 |
8010 |
8011 |
|
Agent admin |
9999 |
9998 |
9997 |
|
servlet/server.xml |
http |
8090 |
8091 |
8092 |
ajp13 |
8009 |
8010 |
8011 |
|
webservice/server-transports-template.xml |
Standalone server http |
9090 |
9091 |
9092 |
Standalone server https |
9443 |
9444 |
9445 |
- Set up the environment for each installation and start the agent using rwsfserver start.
- Test and troubleshoot.
In this case agent.log will be in a different location for each Agent and the loggers.xml file does not need to be edited. Use the <RWSF_HOME>/logs/agent.log file inside of each installation folder to confirm each of the Agents starts correctly.
With Multiple Network Interface Cards and IP Addresses
In situations where one machine has multiple Network Interface Cards which are configured to use different IP addresses, HydraAgent allows the user to setup different connectors for each IP address inside the conf/rwagent.xml file. For example, you can make two HTTP connectors to use two different IP addresses.
<rwsf:connector name="HTTP1"
class="rwsf_transport_http35.createHttpConnectorImp"
handlerChain="http">
…
<rwsf:property name="host" value="<IP Address 1>"/>
<rwsf:property name="port" value="8090"/>
…
</rwsf:connector>
<rwsf:connector name="HTTP2"
class="rwsf_transport_http35.createHttpConnectorImp"
handlerChain="http">
…
<rwsf:property name="host" value="<IP Address 2>"/>
<rwsf:property name="port" value="8091"/>
<rwsf:property name="request-backlog" value="10"/>
…
</rwsf:connector>
Multiple Agents on Separate Machines
When running each of multiple Agents on separate machines, the default port settings won't cause conflicts. Editing the configuration files is not required in this case but you can edit them if desired. A copy of the Agent Runtime package should be installed on each machine and the environment configured on each machine. For convenient deployment of the Agent to these remote machines, put the Hydra packages on a network drive so they can be copied to any machine. You may also want to create a template script that can be copied to each machine and customized as needed.