Terracotta Ehcache 10.7 | Terracotta Server Administration Guide | Terracotta in Network Environments with Subnets
 
Terracotta in Network Environments with Subnets
If Terracotta nodes reside in a given subnet (for example in a Kubernetes cluster) and clients in another (for example outside of the Kubernetes cluster), node addresses (host name or IP address) are not resolvable by clients. Administrators of the Terracotta cluster can use public addresses in this scenario to assign public names to Terracotta cluster nodes, using which clients can establish connections.
Configuring public addresses
Public addresses, if configured, need to be defined on all the nodes in the cluster. This can be achieved using one of the following ways:
Using command-line parameters during node startup
Public addresses can be configured on each node during startup by using the properties public-hostname and public-port.
The following example illustrates setting the public hostname tc-cluster.public.com and public ports 1111 and 2222 respectively on two nodes during startup:
> start-tc-server.sh public-hostname=tc-cluster.public.com public-port=1111 -n node-1 ...
> start-tc-server.sh public-hostname=tc-cluster.public.com public-port=2222 -n node-2 ...
Using config file during node startup
Public addresses for the entire cluster can alternatively be saved in a Terracotta config file, which can later be used to start a cluster. See the section The Terracotta Configuration File for more details.
The following example illustrates setting the public hostname tc-cluster.public.com for both the stripes, and public ports 1111 and 2222 for the first and second stripes respectively:
stripe.1.node.1.public-hostname=tc-cluster.public.com
stripe.1.node.1.public-port=1111
stripe.2.node.1.public-hostname=tc-cluster.public.com
stripe.2.node.1.public-port=2222
Using config tool "set" command
The config tool set command can be used to dynamically configure public addresses on a cluster. NOTE: Public addresses can be updated without restarting the cluster. See the section Performing configuration changes for more details.
The following example illustrates setting the public hostname tc-cluster.public.com on all the nodes of a 2 stripe cluster, and public ports 1111 and 2222 respectively:
> config-tool.sh set -s tc-cluster.internal.com:9410
-c public-hostname=tc-cluster.public.com
-c stripe.1.node.1.public-port=1111
-c stripe.2.node.1.public-port=2222
SSL/TLS considerations The SSL/TLS certificates of the Terracotta nodes will need to include Subject Alternative Names (SANs) that match the public addresses.
Using public addresses
Once the public addresses have been set, all tools (e.g. config tool, cluster tool etc.) would use the public addresses by default.
The following example illustrates the execution of the cluster tool status command on the cluster with public addresses configured. Take note of how the internal to public address mapping is displayed in the Address column:
> cluster-tool.sh status -n tc-cluster -s tc-cluster.public.com:1111

| STRIPE: 1 |
+--------------+--------------------------------------------------------------+----------------+
| Server Name | Address | Status |
+--------------+--------------------------------------------------------------+----------------+
| node-1 | tc-cluster.internal.com:9410=tc-cluster.public.com:1111 | ACTIVE |
------------------------------------------------------------------------------------------------

| STRIPE: 2 |
+--------------+--------------------------------------------------------------+----------------+
| Server Name | Address | Status |
+--------------+--------------------------------------------------------------+----------------+
| node-2 | tc-cluster.internal.com:9510=tc-cluster.public.com:2222 | ACTIVE |
------------------------------------------------------------------------------------------------