realtime sync of files between instances

In my scenario, i have 2 ec2 instances and need to sync the files between them in realtime. Can I do this with rsync? Can anyone please suggest how to schedule a rsync?


Solution 1:

Don't try to sync file systems. Read and write your files to S3 directly.

Syncing file systems adds an additional level of complexity to your application that's unnecessary. If the synchronization of the file system fails for any reason, your app will start failing.

Keep things simple: construct your application to use S3 effectively.

Solution 2:

You have many alternatives:

  1. You can use Amazon's S3 to store files and access it via s3fs on both machines.
  2. You can use some cluster filesystem like GlusterFS or GVFS2.