Web Sessions 4.3.10 | Web Sessions User Guide | Installing and Configuring Web Sessions | Configuring Your Web Sessions Cluster
 
Configuring Your Web Sessions Cluster
Terracotta servers, and Terracotta clients running on the application servers in the cluster, are configured with a Terracotta configuration file, tc-config.xml by default. Servers that are not started with a specified configuration will use a default configuration.
To add Terracotta clustering to your application, you must specify how Terracotta clients get their configuration by including the source in your web.xml file. Add the following configuration snippet to web.xml:
<filter>
<filter-name>terracotta</filter-name>
<!-- The filter class is specific to the application server. -->
<filter-class>org.terracotta.session.{container-specific-class}</filter-class>
<init-param>
<param-name>tcConfigUrl</param-name>
<!-- <init-param> of type tcConfigUrl has a <param-value> element containing
the URL or filepath (for example, /lib/tc-config.xml) to tc-config.xml.
If the Terracotta configuration source changes at a later time,
it must be updated in configuration. -->
<param-value>localhost:9510</param-value>
</init-param>
<!-- The following init-params are optional.
<init-param>
<param-name>synchronousWrite</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>sessionLocking</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>maxBytesOnHeap</param-name>
<param-value>128M</param-value>
</init-param>
<init-param>
<param-name>maxBytesOffHeap</param-name>
<param-value>4G</param-value>
</init-param>
<init-param>
<param-name>rejoin</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>nonStopTimeout</param-name>
<param-value>-1</param-value>
</init-param>
<init-param>
<param-name>concurrency</param-name>
<param-value>0</param-value>
</init-param>
<!-- End of optional init-params. -->
</filter>
<filter-mapping>
<!-- Must match filter name from above. -->
<filter-name>terracotta</filter-name>
<url-pattern>/*</url-pattern>
<!-- Enable all available dispatchers. -->
<dispatcher>ERROR</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<filter-name> can contain a string of your choice. However, the value of <filter>/<filter-name> must match <filter-mapping>/<filter-name>.
Choose the appropriate value for <filter-class> from the following table.
Container
Value of <filter-class>
GlassFish
org.terracotta.session.TerracottaGlassfish31xSessionFilter
JBoss 6.1.x
org.terracotta.session.TerracottaJboss61xSessionFilter
JBoss 7.1.x
org.terracotta.session.TerracottaJboss71xSessionFilter
JBoss 7.2.x
org.terracotta.session.TerracottaJboss72xSessionFilter
Jetty 8.1.x
org.terracotta.session.TerracottaJetty81xSessionFilter
Jetty 9.0.x
org.terracotta.session.TerracottaJetty90xSessionFilter
Resin
org.terracotta.session.TerracottaResin40xSessionFilter
Tomcat 6.0.x
org.terracotta.session.TerracottaTomcat60xSessionFilter
Tomcat 7.0.x
org.terracotta.session.TerracottaTomcat70xSessionFilter
WebLogic 10.3.x
org.terracotta.session.TerracottaWeblogic103xSessionFilter
WebLogic 12.1.x
org.terracotta.session.TerracottaWeblogic121xSessionFilter
WebSphere 7.0.x
org.terracotta.session.TerracottaWebsphere70xSessionFilter
WebSphere 8.0.x
org.terracotta.session.TerracottaWebsphere80xSessionFilter
WebSphere 8.5.x
org.terracotta.session.TerracottaWebsphere85xSessionFilter
Ensure that the Terracotta filter is the first <filter> element listed in web.xml. Filters processed ahead of the Terracotta filter may disrupt its processing.
web.xml should be in /WEB-INF if you are using a WAR file.