How to Synchronize Data Between Distributed Servers Across Regions
This document explains how to set up one-way data synchronization between two NeevCloud servers located in different regions (Central India and Mumbai). The synchronization will ensure that new and updated files are transferred, while deletions on the source server do not remove files on the destination server.
We will use rclone, a powerful command-line tool for managing and syncing files across different storage systems.
Prerequisites
Two NeevCloud servers:
Server A (Central India) → Source
Server B (Mumbai) → Destination
SSH access between the two servers.
SSH key-based authentication configured:
id_rsa(private key) present on Server Aid_rsa.pubadded to/home/ubuntu/.ssh/authorized_keys(or/root/.ssh/authorized_keys) on Server B
rclone installed on Server A (Central India):
Step 1: Verify SSH Key Access
From Server A, confirm that you can log in to Server B without a password.
Run the ssh-keygen command
ssh-keygen -t rsa -b 409You can now check that the SSH key has been created

Copy your public key to the server.
After running the command, it will ask for a password. Enter the password, and after logging that, disable password authentication.
Test the connection
Step 2: Configure rclone
rclone installed on Server A (Central India):
Run the configuration command on Server A:
Follow the prompts:
New remote → n
Name → mumbai
Storage type → 13) SFTP (The numbers may vary depending on the rclone version used
SSH host → <Mumbai_Server_IP>
SSH username → ubuntu (or root, depending on your setup)
SSH port → 22 (default)
SSH key file → /root/.ssh/id_rsa
key_use_agent → false
Password → n (leave blank)
After completing all the configurations, you will see a setup like this.

List the files in Server B’s home directory:

Step 3: Sync Files (Without Deletion)
To copy files from Server A → Server B while preserving existing files:
copy→ copies new/updated files only, does not delete existing ones--progress→ shows real-time progress

Now, check the other server in the Mumbai region

Step 5: Automate with Cron
To run that command every minute, the best method on a modern Linux system is to use a systemd service paired with a timer. This is more robust and manageable than a traditional cron job.
First, you need the full path to the rclone program and your test.txt file, as systemd services run in a clean environment without your personal items PATH settings.
Find the path to rclone:
Create the Sync Script File
This file defines what command to run. We will rename the file.
Run the following command. Ensure that you replace the placeholder paths with your actual paths.
SRC="/root/test.txt" ---> Source Path DST="testmumbai:/root/" ---> Destination Path
Make it executable:
Create the Systemd Service File
Create the systemd Timer File
Reload systemd to make it aware of your new service and timer files.
Enable and start the rclone-sync service.
Enable and start the rclone-sync timer.
After that, I created a file in the Indore region and transferred it to Mumbai.

Now log in to your Mumbai region server and check if the file is visible
Let's check if the file is visible and the content remains.

Last updated