Configuring a Terracotta Cluster
This step shows you how to run clients and servers on separate machines and add failover (High Availability). You will expand the Terracotta cluster and add High Availability by doing the following:
Moving the Terracotta server to its own machine
Creating a cluster with multiple Terracotta servers
Creating multiple application nodes
These tasks bring your cluster closer to a production architecture.
Note: For additional details about configuring a Terracotta cluster, see the "Configuring a Terracotta Server Array" and "Terracotta Configuration Parameters" chapters in the BigMemory Max Administrator Guide. For additional details about configuring a cluster for high availability, see the BigMemory Max High-Availability Guide.
To configure a Terracotta cluster
1. Shut down the Terracotta cluster.
2. Create a Terracotta configuration file called tc-config.xml with contents similar to the following:
<?xml version="1.0" encoding="UTF-8"?>
<!-- All content copyright Terracotta, Inc., unless otherwise indicated.
All rights reserved. -->
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-9.xsd"
xmlns:tc="http://www.terracotta.org/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<!-- Sets where the Terracotta server can be found.
Replace the value of host with the server's IP address. -->
<server host="server.1.ip.address" name="Server1">
<data>%(user.home)/terracotta/server-data</data>
<logs>%(user.home)/terracotta/server-logs</logs>
</server>
<!-- If using a standby Terracotta server, also referred to as
an ACTIVE-PASSIVE configuration, add the second server here. -->
<server host="server.2.ip.address" name="Server2">
<data>%(user.home)/terracotta/server-data</data>
<logs>%(user.home)/terracotta/server-logs</logs>
</server>
</servers>
<!-- Sets where the generated client logs are saved on clients. -->
<clients>
<logs>%(user.home)/terracotta/client-logs</logs>
</clients>
</tc:tc-config>
3. Install Terracotta on a separate machine for each server you configure in tc-config.xml.
4. Copy the tc-config.xml to a location accessible to the Terracotta servers.
5. Install the Sessions JAR files on each application node you want to run in the cluster. Be sure to install your application and any application servers on each node. For information about installing the Sessions JAR files, see Installing the Session JARS. 6. Edit web.xml on each application server to list both Terracotta servers:
<param-value>server.1.ip.address:9510,server.2.ip.address:9510</param-value>
7. Start the Terracotta server in the following way, replacing "Server1" with the name you gave your server in tc-config.xml:
UNIX/Linux
[PROMPT] ${TERRACOTTA_HOME}/server/bin/start-tc-server.sh -f <path/to/tc-config.xml> \
-n Server1
Microsoft Windows
[PROMPT] ${TERRACOTTA_HOME}\server\bin\start-tc-server.bat -f <path\to\tc-config.xml> ^
-n Server1
If you configured a second server, start that server in the same way on its machine, entering its name after the -n flag. The second server to start up becomes the hot standby, or PASSIVE. Any other servers you configured will also start up as standby servers.
8. Start all application servers.