- The recommended way to set up the sync.cluster.interface property is in the
config.yml file. This specifies a particular network
interface that Hazelcast uses for clustering. It could be a wildcard value, such
as 10.256.*.*, which means an attempt is made to bind with an
interface having an IP address that begins with
10.256:
sync: cluster: interface: 10.256.*.*By doing this, all the dynamically started Sync instances will be able to see each other and form a cluster successfully. - To run various operations on a Sync Service instance via JMX (for example, checking the number of instances in the cluster, running a cluster wide check to ensure that each member sees each other, shutting down the Sync Service etc.), you’ll need to connect from a bastion host (i.e. a machine located in the same network as the instance). This is required because the syncservice.sh script that’s embedded in the AlfrescoSyncServer-x.x.x.zip distribution ZIP doesn’t specify a value for java.rmi.server.hostname. By doing this, JMX will bind to the private IP, allowing Sync instances to be started dynamically by AWS Auto Scaling groups.
- The last and most important aspect is to ensure that Sync Service is shut down gracefully, by running the ./syncservice.sh stop command. This will prevent hanging database connections. In addition, this will allow the current sync instance to deregister from the database.
When Sync Service starts, Hazelcast tries to find the other cluster members by performing connections with IPs of previously registered clustered members stored in the database. By deregistering a soon to be dead cluster member from the database means a smaller number of connections will be attempted. This should result in faster startup times for Hazelcast and inherently the Sync Service.
To correctly run ./syncservice.sh stop when the instance is terminated, where you’ll be using Auto Scaling lifecycle hooks, Lambda, and the EC2 Run Command, follow the steps listed in the aws-lambda-lifecycle-hooks-function GitHub repository in the AWS Samples organization, available at https://github.com.
Note: You’ll need to modify some of the steps in this function.