Class CasEmbeddedApacheTomcatClusteringProperties
java.lang.Object
org.apereo.cas.configuration.model.core.web.tomcat.CasEmbeddedApacheTomcatClusteringProperties
- All Implemented Interfaces:
Serializable
@RequiresModule(name="cas-server-webapp-tomcat")
public class CasEmbeddedApacheTomcatClusteringProperties
extends Object
implements Serializable
- Since:
- 5.3.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
This option is used to set the flag that all messages sent through the SimpleTcpCluster uses.Cloud membership provider, values are case sensitive and only used with clusteringTypeCLOUD
.Accepted values are:DEFAULT, CLOUD
.Statically register members in the cluster.Accepted values are:DELTA, BACKUP
.Multicast address for membership.int
The membership component will time out members and notify the Channel if a member fails to send a heartbeat within a give time.int
The frequency in milliseconds in which heartbeats are sent out.int
Multicast port (the port and the address together determine cluster membership.int
Membership uses multicast, it will call java.net.MulticastSocket.setLoopbackMode(localLoopbackDisabled).The address (network interface) to listen for incoming traffic.int
Default value is 100.int
Maximum threads configured for the listener.int
The listen port for incoming data.int
Listener timeout.boolean
Enable tomcat session clustering.boolean
When a web application is being shutdown, Tomcat issues an expire call to each session to notify all the listeners.boolean
Membership uses multicast, it will call java.net.MulticastSocket.setLoopbackMode(localLoopbackDisabled).boolean
In case of a network failure, Java multicast socket don't transparently fail over, instead the socket will continuously throwIOException
upon each receive request.setChannelSendOptions
(int channelSendOptions) This option is used to set the flag that all messages sent through the SimpleTcpCluster uses.setCloudMembershipProvider
(String cloudMembershipProvider) Cloud membership provider, values are case sensitive and only used with clusteringTypeCLOUD
.setClusteringType
(String clusteringType) Accepted values are:DEFAULT, CLOUD
.setClusterMembers
(String clusterMembers) Statically register members in the cluster.setEnabled
(boolean enabled) Enable tomcat session clustering.setExpireSessionsOnShutdown
(boolean expireSessionsOnShutdown) When a web application is being shutdown, Tomcat issues an expire call to each session to notify all the listeners.setManagerType
(String managerType) Accepted values are:DELTA, BACKUP
.setMembershipAddress
(String membershipAddress) Multicast address for membership.setMembershipDropTime
(int membershipDropTime) The membership component will time out members and notify the Channel if a member fails to send a heartbeat within a give time.setMembershipFrequency
(int membershipFrequency) The frequency in milliseconds in which heartbeats are sent out.setMembershipLocalLoopbackDisabled
(boolean membershipLocalLoopbackDisabled) Membership uses multicast, it will call java.net.MulticastSocket.setLoopbackMode(localLoopbackDisabled).setMembershipPort
(int membershipPort) Multicast port (the port and the address together determine cluster membership.setMembershipRecoveryCounter
(int membershipRecoveryCounter) Membership uses multicast, it will call java.net.MulticastSocket.setLoopbackMode(localLoopbackDisabled).setMembershipRecoveryEnabled
(boolean membershipRecoveryEnabled) In case of a network failure, Java multicast socket don't transparently fail over, instead the socket will continuously throwIOException
upon each receive request.setReceiverAddress
(String receiverAddress) The address (network interface) to listen for incoming traffic.setReceiverAutoBind
(int receiverAutoBind) Default value is 100.setReceiverMaxThreads
(int receiverMaxThreads) Maximum threads configured for the listener.setReceiverPort
(int receiverPort) The listen port for incoming data.setReceiverTimeout
(int receiverTimeout) Listener timeout.
-
Constructor Details
-
CasEmbeddedApacheTomcatClusteringProperties
public CasEmbeddedApacheTomcatClusteringProperties()
-
-
Method Details
-
getClusteringType
Accepted values are:DEFAULT, CLOUD
. Type of clustering to use, set toCLOUD
if usingCloudMembershipService
. -
getCloudMembershipProvider
Cloud membership provider, values are case sensitive and only used with clusteringTypeCLOUD
. The different providers rely on environment variables to discover other members of cluster via DNS lookups of the service name or querying kubernetes API. See code or Tomcat documentation for the environment variables that are used.-
kubernetes
will use org.apache.catalina.tribes.KubernetesMembershipProvider -
dns
will use org.apache.catalina.tribes.DNSMembershipProvider - Class implementing
org.apache.catalina.tribes.MembershipProvider
-
-
isExpireSessionsOnShutdown
public boolean isExpireSessionsOnShutdown()When a web application is being shutdown, Tomcat issues an expire call to each session to notify all the listeners. If you wish for all sessions to expire on all nodes when a shutdown occurs on one node, set this value to true. Default value is false. -
getChannelSendOptions
public int getChannelSendOptions()This option is used to set the flag that all messages sent through the SimpleTcpCluster uses. The flag decides how the messages are sent, and is a simple logical OR.- 2:
SEND_OPTIONS_SYNCHRONIZED_ACK
- 4:
SEND_OPTIONS_USE_ACK
- 8:
SEND_OPTIONS_ASYNCHRONOUS
- 2:
-
getReceiverPort
public int getReceiverPort()The listen port for incoming data. The default value is4000
. To avoid port conflicts the receiver will automatically bind to a free port. So for example, if port is4000
, and autoBind is set to 10, then the receiver will open up a server socket on the first available port in the range 4000-4009. -
getReceiverTimeout
public int getReceiverTimeout()Listener timeout. The value in milliseconds for the polling timeout in the NioReceiver. On older versions of the JDK there have been bugs, that should all now be cleared out where the selector never woke up. The default value is a very high 5000 milliseconds. -
getReceiverMaxThreads
public int getReceiverMaxThreads()Maximum threads configured for the listener. The maximum number of threads in the receiver thread pool. The default value is 6 Adjust this value relative to the number of nodes in the cluster, the number of messages being exchanged and the hardware you are running on. A higher value doesn't mean more efficiency, tune this value according to your own test results. -
getReceiverAddress
The address (network interface) to listen for incoming traffic. -
getReceiverAutoBind
public int getReceiverAutoBind()Default value is 100. Use this value if you wish to automatically avoid port conflicts the cluster receiver will try to open a server socket on the port attribute port, and then work up autoBind number of times. -
getClusterMembers
Statically register members in the cluster. The syntax is:address:port:index
-
getMembershipPort
public int getMembershipPort()Multicast port (the port and the address together determine cluster membership. The multicast port, the default value is 45564 The multicast port, in conjunction with the address is what creates a cluster group. To divide up your farm into several different group, or to split up QA from production, change the port or the address -
getMembershipAddress
Multicast address for membership. The multicast address that the membership will broadcast its presence and listen for other heartbeats on. The default value is 228.0.0.4 Make sure your network is enabled for multicast traffic. The multicast address, in conjunction with the port is what creates a cluster group. To divide up your farm into several different group, or to split up QA from production, change the port or the address -
getMembershipFrequency
public int getMembershipFrequency()The frequency in milliseconds in which heartbeats are sent out. The default value is 500 ms. In most cases the default value is sufficient. Changing this value, changes the interval in between heartbeats. -
getMembershipDropTime
public int getMembershipDropTime()The membership component will time out members and notify the Channel if a member fails to send a heartbeat within a give time. The default value is 3000 ms. This means, that if a heartbeat is not received from a member in that timeframe, the membership component will notify the cluster of this. On a high latency network you may wish to increase this value, to protect against false positives. Apache Tribes also provides a TcpFailureDetector that will verify a timeout using a TCP connection when a heartbeat timeout has occurred. This protects against false positives. -
isMembershipRecoveryEnabled
public boolean isMembershipRecoveryEnabled()In case of a network failure, Java multicast socket don't transparently fail over, instead the socket will continuously throwIOException
upon each receive request. When recovery-enabled is set to true, this will close the multicast socket and open a new socket with the same properties as defined above. The default is true. -
isMembershipLocalLoopbackDisabled
public boolean isMembershipLocalLoopbackDisabled()Membership uses multicast, it will call java.net.MulticastSocket.setLoopbackMode(localLoopbackDisabled). When localLoopbackDisabled==true multicast messages will not reach other nodes on the same local machine. The default is false. -
getMembershipRecoveryCounter
public int getMembershipRecoveryCounter()Membership uses multicast, it will call java.net.MulticastSocket.setLoopbackMode(localLoopbackDisabled). When localLoopbackDisabled==true multicast messages will not reach other nodes on the same local machine. The default is false. -
getManagerType
Accepted values are:DELTA, BACKUP
. Enable all-to-all session replication using the DeltaManager to replicate session deltas. By all-to-all we mean that the session gets replicated to all the other nodes in the cluster. This works great for smaller cluster but we don't recommend it for larger clusters(a lot of Tomcat nodes). Also when using the delta manager it will replicate to all nodes, even nodes that don't have the application deployed. To get around this problem, you'll want to use the BackupManager. This manager only replicates the session data to one backup node, and only to nodes that have the application deployed. Downside of the BackupManager: not quite as battle tested as the delta manager. -
isEnabled
public boolean isEnabled()Enable tomcat session clustering. -
setClusteringType
Accepted values are:DEFAULT, CLOUD
. Type of clustering to use, set toCLOUD
if usingCloudMembershipService
.- Returns:
this
.
-
setCloudMembershipProvider
public CasEmbeddedApacheTomcatClusteringProperties setCloudMembershipProvider(String cloudMembershipProvider) Cloud membership provider, values are case sensitive and only used with clusteringTypeCLOUD
. The different providers rely on environment variables to discover other members of cluster via DNS lookups of the service name or querying kubernetes API. See code or Tomcat documentation for the environment variables that are used.-
kubernetes
will use org.apache.catalina.tribes.KubernetesMembershipProvider -
dns
will use org.apache.catalina.tribes.DNSMembershipProvider - Class implementing
org.apache.catalina.tribes.MembershipProvider
- Returns:
this
.
-
-
setExpireSessionsOnShutdown
public CasEmbeddedApacheTomcatClusteringProperties setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown) When a web application is being shutdown, Tomcat issues an expire call to each session to notify all the listeners. If you wish for all sessions to expire on all nodes when a shutdown occurs on one node, set this value to true. Default value is false.- Returns:
this
.
-
setChannelSendOptions
This option is used to set the flag that all messages sent through the SimpleTcpCluster uses. The flag decides how the messages are sent, and is a simple logical OR.- 2:
SEND_OPTIONS_SYNCHRONIZED_ACK
- 4:
SEND_OPTIONS_USE_ACK
- 8:
SEND_OPTIONS_ASYNCHRONOUS
- Returns:
this
.
- 2:
-
setReceiverPort
The listen port for incoming data. The default value is4000
. To avoid port conflicts the receiver will automatically bind to a free port. So for example, if port is4000
, and autoBind is set to 10, then the receiver will open up a server socket on the first available port in the range 4000-4009.- Returns:
this
.
-
setReceiverTimeout
Listener timeout. The value in milliseconds for the polling timeout in the NioReceiver. On older versions of the JDK there have been bugs, that should all now be cleared out where the selector never woke up. The default value is a very high 5000 milliseconds.- Returns:
this
.
-
setReceiverMaxThreads
Maximum threads configured for the listener. The maximum number of threads in the receiver thread pool. The default value is 6 Adjust this value relative to the number of nodes in the cluster, the number of messages being exchanged and the hardware you are running on. A higher value doesn't mean more efficiency, tune this value according to your own test results.- Returns:
this
.
-
setReceiverAddress
The address (network interface) to listen for incoming traffic.- Returns:
this
.
-
setReceiverAutoBind
Default value is 100. Use this value if you wish to automatically avoid port conflicts the cluster receiver will try to open a server socket on the port attribute port, and then work up autoBind number of times.- Returns:
this
.
-
setClusterMembers
Statically register members in the cluster. The syntax is:address:port:index
- Returns:
this
.
-
setMembershipPort
Multicast port (the port and the address together determine cluster membership. The multicast port, the default value is 45564 The multicast port, in conjunction with the address is what creates a cluster group. To divide up your farm into several different group, or to split up QA from production, change the port or the address- Returns:
this
.
-
setMembershipAddress
Multicast address for membership. The multicast address that the membership will broadcast its presence and listen for other heartbeats on. The default value is 228.0.0.4 Make sure your network is enabled for multicast traffic. The multicast address, in conjunction with the port is what creates a cluster group. To divide up your farm into several different group, or to split up QA from production, change the port or the address- Returns:
this
.
-
setMembershipFrequency
The frequency in milliseconds in which heartbeats are sent out. The default value is 500 ms. In most cases the default value is sufficient. Changing this value, changes the interval in between heartbeats.- Returns:
this
.
-
setMembershipDropTime
The membership component will time out members and notify the Channel if a member fails to send a heartbeat within a give time. The default value is 3000 ms. This means, that if a heartbeat is not received from a member in that timeframe, the membership component will notify the cluster of this. On a high latency network you may wish to increase this value, to protect against false positives. Apache Tribes also provides a TcpFailureDetector that will verify a timeout using a TCP connection when a heartbeat timeout has occurred. This protects against false positives.- Returns:
this
.
-
setMembershipRecoveryEnabled
public CasEmbeddedApacheTomcatClusteringProperties setMembershipRecoveryEnabled(boolean membershipRecoveryEnabled) In case of a network failure, Java multicast socket don't transparently fail over, instead the socket will continuously throwIOException
upon each receive request. When recovery-enabled is set to true, this will close the multicast socket and open a new socket with the same properties as defined above. The default is true.- Returns:
this
.
-
setMembershipLocalLoopbackDisabled
public CasEmbeddedApacheTomcatClusteringProperties setMembershipLocalLoopbackDisabled(boolean membershipLocalLoopbackDisabled) Membership uses multicast, it will call java.net.MulticastSocket.setLoopbackMode(localLoopbackDisabled). When localLoopbackDisabled==true multicast messages will not reach other nodes on the same local machine. The default is false.- Returns:
this
.
-
setMembershipRecoveryCounter
public CasEmbeddedApacheTomcatClusteringProperties setMembershipRecoveryCounter(int membershipRecoveryCounter) Membership uses multicast, it will call java.net.MulticastSocket.setLoopbackMode(localLoopbackDisabled). When localLoopbackDisabled==true multicast messages will not reach other nodes on the same local machine. The default is false.- Returns:
this
.
-
setManagerType
Accepted values are:DELTA, BACKUP
. Enable all-to-all session replication using the DeltaManager to replicate session deltas. By all-to-all we mean that the session gets replicated to all the other nodes in the cluster. This works great for smaller cluster but we don't recommend it for larger clusters(a lot of Tomcat nodes). Also when using the delta manager it will replicate to all nodes, even nodes that don't have the application deployed. To get around this problem, you'll want to use the BackupManager. This manager only replicates the session data to one backup node, and only to nodes that have the application deployed. Downside of the BackupManager: not quite as battle tested as the delta manager.- Returns:
this
.
-
setEnabled
Enable tomcat session clustering.- Returns:
this
.
-