Starting and Stopping the Cluster

Once you have correctly configured your cluster, you can use the standard Tomcat startup and shutdown scripts to start and stop each node. With these commands, nodes automatically join and leave the cluster.

Starting Each Node

Data Hub ships with two standard cluster configuration resources: one for the seed node, and one for standard nodes. Configure each node to use the appropriate configuration resource as described in Setting Up a Cluster. Begin by starting the seed node using the provided Tomcat startup script in the <TOMCAT_HOME>/bin directory.

./startup.sh

When the seed node starts it does an integrity check. This check is part of the standard Data Hub recovery process, and looks for any processes in an undesirable state that may need restarting. The recovery logic resides only on the seed node, so this node is the only one to perform this check on startup.

2016-11-11 11:13:57,045 [INFO] [a.c.s.ClusterSingletonManager] ClusterSingletonManager state change [Start -> Oldest]
2016-11-11 11:13:57,063 [INFO] [c.h.d.l.i.DefaultInitializationService] *******************************************************************
2016-11-11 11:13:57,063 [INFO] [c.h.d.l.i.DefaultInitializationService] * Starting Integrity Check. This process could take a few minutes *
2016-11-11 11:13:57,064 [INFO] [c.h.d.l.i.DefaultInitializationService] *******************************************************************

Wait for this node to start up completely before starting any other node. Once the seed node is up, start each additional node in the same way. If configured correctly, each node automatically joins the cluster.

2016-11-11 11:44:44,402 [INFO] [a.c.Cluster(akka://DataHubActorSystem)] Cluster Node [akka.ssl.tcp://DataHubActorSystem@10.0.0.1:2551] - Node [akka.ssl.tcp://DataHubActorSystem@10.0.0.2:2552] is JOINING, roles []
2016-11-11 11:44:44,899 [INFO] [a.c.Cluster(akka://DataHubActorSystem)] Cluster Node [akka.ssl.tcp://DataHubActorSystem@10.0.0.1:2551] - Leader is moving node [akka.ssl.tcp://DataHubActorSystem@10.0.0.2:2552] to [Up]

Your cluster is ready for operation once you have started the first node, the seed node. You can add additional nodes at any time without interrupting Data Hub functionality.

Stopping Each Node

To stop a node in the cluster, use the standard Tomcat shutdown script on that node.

$ ./shutdown.sh

This command begins the shutdown of the node, which then leaves the cluster.

2016-11-11 11:46:59,103 [INFO] [a.c.Cluster(akka://DataHubActorSystem)] Cluster Node [akka.ssl.tcp://DataHubActorSystem@10.0.0.2:2552] - Marked address [akka.ssl.tcp://DataHubActorSystem@10.0.0.2:2552] as [Leaving]
2016-11-11 11:46:59,921 [INFO] [a.c.Cluster(akka://DataHubActorSystem)] Cluster Node [akka.ssl.tcp://DataHubActorSystem@10.0.0.2:2552] - Shutting down...
2016-11-11 11:46:59,921 [INFO] [a.c.Cluster(akka://DataHubActorSystem)] Cluster Node [akka.ssl.tcp://DataHubActorSystem@10.0.0.2:2552] - Successfully shut down
2016-11-11 11:46:59,922 [INFO] [a.c.s.ClusterSingletonManager] Exited [akka.ssl.tcp://DataHubActorSystem@10.0.0.2:2552]

The seed node recognizes that a node has left the cluster, and changes its state.

2016-11-11 11:46:59,908 [INFO] [a.c.Cluster(akka://DataHubActorSystem)] Cluster Node [akka.ssl.tcp://DataHubActorSystem@10.0.0.1:2551] - Leader is moving node [akka.ssl.tcp://DataHubActorSystem@10.0.0.2:2552] to [Exiting]
2016-11-11 11:46:59,978 [ERROR] [a.r.EndpointWriter] AssociationError [akka.ssl.tcp://DataHubActorSystem@10.0.0.1:2551] <- [akka.ssl.tcp://DataHubActorSystem@10.0.0.2:2552]: Error [Shut down address: akka.ssl.tcp://DataHubActorSystem@10.0.0.2:2552] [
akka.remote.ShutDownAssociation: Shut down address: akka.ssl.tcp://DataHubActorSystem@10.0.0.2:2552
Caused by: akka.remote.transport.Transport$InvalidAssociationException: The remote system terminated the association because it is shutting down.

If the cluster leader is shut down in this way, the next oldest node takes on the leader duties and becomes the new cluster leader. When taking over, the new leader runs an integrity check, then resumes any pending processes that may have been in progress at the time.

2016-11-11 13:17:12,550 [INFO] [a.c.s.ClusterSingletonManager] Younger observed OldestChanged: [Some(akka.ssl.tcp://DataHubActorSystem@10.0.0.1:2551) -> myself]
2016-11-11 13:17:12,555 [INFO] [a.c.s.ClusterSingletonManager] ClusterSingletonManager state change [Younger -> BecomingOldest]
2016-11-11 13:17:12,629 [ERROR] [a.r.EndpointWriter] AssociationError [akka.ssl.tcp://DataHubActorSystem@10.0.0.2:2552] -> [akka.ssl.tcp://DataHubActorSystem@10.0.0.1:2551]: Error [Shut down address: akka.ssl.tcp://DataHubActorSystem@10.0.0.1:2551] [
akka.remote.ShutDownAssociation: Shut down address: akka.ssl.tcp://DataHubActorSystem@10.0.0.1:2551
Caused by: akka.remote.transport.Transport$InvalidAssociationException: The remote system terminated the association because it is shutting down.
]

...

2016-11-11 13:17:17,742 [INFO] [a.c.Cluster(akka://DataHubActorSystem)] Cluster Node [akka.ssl.tcp://DataHubActorSystem@10.0.0.2:2552] - Leader is removing exiting node [akka.ssl.tcp://DataHubActorSystem@10.0.0.1:2551]
2016-11-11 13:17:17,744 [INFO] [a.c.s.ClusterSingletonManager] Previous oldest [akka.ssl.tcp://DataHubActorSystem@10.0.0.1:2551] removed
2016-11-11 13:17:17,745 [INFO] [a.c.s.ClusterSingletonManager] Singleton manager starting singleton actor [akka://DataHubActorSystem/user/eventHandlerManager/poolEventHandler]
2016-11-11 13:17:17,746 [INFO] [a.c.s.ClusterSingletonManager] ClusterSingletonManager state change [BecomingOldest -> Oldest]
2016-11-11 13:17:17,788 [INFO] [c.h.d.l.i.DefaultInitializationService] *******************************************************************
2016-11-11 13:17:17,788 [INFO] [c.h.d.l.i.DefaultInitializationService] * Starting Integrity Check. This process could take a few minutes *
2016-11-11 13:17:17,788 [INFO] [c.h.d.l.i.DefaultInitializationService] *******************************************************************

When shutting down a cluster normally, begin with the non seed nodes to avoid unnecessary state changes, and end with the seed node. The cluster is completely down when all nodes have been shut down.