General guidelines - General guidelines - Alfresco - Alfresco Sync Service - Alfresco/Alfresco-Sync-Service/5.2/Alfresco-Sync-Service/Administer/Set-up-clustering/General-guidelines - 5.2 - 5.2

Alfresco Sync Service

Platform
Alfresco
Product
Alfresco Sync Service
Release
5.2
License
ft:lastPublication
2026-05-28T22:10:46.888000
ft:locale
en-US
  • 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.
  1. Step 1 - Create an SNS topic to receive the result of the backup

    Skip this step.

  2. Step 3 - Create an Auto Scaling group and configure the lifecycle hook
    1. Instead of using the User Data to specify the script to install the AWS Systems Manager (SSM) agent, you can manually install it, and then only afterwards, create the necessary AMI.
      To identify the steps depending on your Linux flavor, see the Manually installing and uninstalling SSM Agent on EC2 instances for Linux article in the AWS Systems Manager User Guide, available at https://docs.aws.amazon.com.
    2. Add the lifecycle hooks from the user interface.
    3. Add a lifecycle hook from the Auto Scaling Groups EC2 console.

      Complete the following fields:

      • Lifecycle Transition: Instance Terminate
      • Heartbeat Timeout: 300 seconds

        This defines the amount of time it takes from when the hook is invoked till the instance is terminated - 300s should be more than enough for the ./syncservice.sh stop command to run.

  3. Step 4 - Create an S3 bucket for files

    Skip this step.

  4. Step 5 - Create the SSM document

    The AWS Systems Manager document (SSM document) can be simplified to just execute ./syncservice.sh stop. See the AWS Systems Manager Documents article in the AWS Systems Manager User Guide, available at https://docs.aws.amazon.com for more information.

    There's no need to add code to complete the lifecycle hook, since this is done inside the abandon_lifecycle method of the lambda_backup.py Python script provided in the aws-lambda-lifecycle-hooks-function GitHub repository.

     {
         "schemaVersion": "1.2",
         "description": "Shuts down Sync Service",
         "parameters": {},
         "runtimeConfig": {
             "aws:runShellScript": {
                 "properties": [
                     {
                         "id": "0.aws:runShellScript",
                         "runCommand": [
                             "#!/usr/bin/env bash",
                             "sudo /home/ubuntu/service-sync/syncservice.sh stop"
                         ]
                     }
                 ]
             }
         }
     }
    
  5. Step 6 - Create the Lambda function

    Make one small change to the Python script.

    1. In def check_command(command_id, instance_id), before checking for the command execution status:
      response_iterator['CommandInvocations'][0]['Status']
    2. Check if the list is empty. For example:
      if not len(response_iterator['CommandInvocations']) == 0: