• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 320
  • Last Modified:

Replication Data between 3 Gegrapical location


I have 2 vps server, from 2 different vendor .
Now i need to find a solution to replication of files between 2 vps and Company Inside .
Please check the picture
(Reason : Office staff can  upload file into any of those server.so i need to instant replication those file into 3 geographical location as those file would be accessible via http)

a)what options do i have ??

note : Rsync( its not a repliation)
           DRBD= i have doubt if i can use drbd in 2 remote host(vps location)

also note : I am trying to find out a a solution for my current situation rather then trying to alter it with SAN or other technology.

thanks for your time and advise.

  • 8
  • 4
1 Solution
One way to manage this is to limit the location to which the upload/change can be made.
i.e. use a hub and spoke setup.  Since you have redundancy in the office and presumably most of the changes will be done in the office, allowing updates via FTP within the office network might be a way to solve this issue.
See if the drbd is an installed or an available package for you Linux distribution.

You might want to have drbd setup within the office servers and use rsync to push changes to the VPS.

Monitoring the location or part of the upload could be a "flag" file.  i.e. if "flag" file is present, the cron script that runs every minute checking whether an rsync is needed or whether 10 minutes passed since the last rsync, will run rsync.  The 10 minute rsync covers the people who forget to upload the flag file.  The flag file is deleted prior to the rsync run (best to remove the flag before you rsync versus after.  Deals with the possibility if a new upload occurs while an rsync is running).
fosiul01Author Commented:
We are not dealing too much of uploading file...
main problem is, session..

we have a shopping cart,.. where it keeps session in file system
Now this shopping cart currently running on VpsSer1 server.

now if i want to spread the loads between 3 server, i need to get a way to copy session instantly between 3 locations

hence i am stuck

suppose if i go to , https://mydomain.com/shopping
it will create session on the Vpsser1, now if it does have have the same session in vpssrv2 and company server, it will logg the user out...

so i need to copy those session from VPSSrv1->vpssrv2>company ...

and by using rsync 5 or 10 minutes will not do the job .....

fosiul01Author Commented:
example, if i try to serve the shopping cart from company server

then i put , all the files related to website, in nfs server. so session is creating into that nfs server.
so any cluster would be able to access that one.

but i cant transfer those in vpsserver1 and vpssrv2 ....
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

You've already setup a mechanism that has data transfer close to real-time. Why not use the DB to to get the data from one to the others?
You can use a separate STATE database.
Before going, see if you can use an image resource to determine whether a cookie set by IPA can be retrieved by IPB and IPC.
fosiul01Author Commented:
You've already setup a mechanism that has data transfer close to real-time. : what you meant by that ?? I did not setup nothing!! what i have setup is mysql server replication
Why not use the DB to to get the data from one to the others?You can use a separate STATE database.   ::  I cant, because its a third-party shopping cart. I dont know anything about its code.Example, i have developed couple of company webiste, our clients they put order via those aswell, and those are all database related, i am keeping session on database, but this shoping cart, its keeping in filesystem.. and hence problem

so i need a realtime soemthing like if it can monitor directory if changes anything on that directory it will fire rsync.....
An entry in the database replicates to the others close to in real-time.
Instead of rsync and monitoring the files for a change, use the monitoring and the newly created files and push them into the database.  Use triggers to write the files back out.
This way if anything goes wrong, you still have the data in a database.
Presumably you also have a session cleanup mechanism on the file system. With the database entry it will be the same

As you mentioned in this or other question, you could via an SSH tunnel/VPN connection setup an NFS share for the session directory.

how is the mysql replication and the rsync currently setup.  Do you have the VPS VPN in?
fosiul01Author Commented:
i was looking for something like this : http://blogs.sun.com/shepler/entry/tunneling_nfs_traffic_via_ssh

whole day!!! thanks for that....  

by using this ssh tunnel and i can syncronized session .... ( but then i saw some ppl saying ssh tunnel can be broken but that a differetn issue)

how is the mysql replication and the rsync currently setup.  Do you have the VPS VPN in?  :

No there is not any vps vpn setup, thats why i was thining of ssh tunneling ..
rsync is doing as normal by using without-password and mysql replicaiton ... ( i dont know what you meant by "how is the mysql replicaiton) just normal , via port 3306 ....

fosiul01Author Commented:
how is the mysql replication and the rsync currently setup.  : by this did not meant , if i am using any ssh tunnleing or ssl or connected 2 sites by vpn for mysql replication ??

if yes,t hen No, i was thiking of ssh tunnleing.. as vpn would not work as its vps server ..

may be i will use ssh tunneling to secure mysql replicaiton ...

or you meant something else??
fosiul01Author Commented:
wait wati...

Rsync with Snapshot is a near-continu ous data protection  (near-CDP)( accoding to book)

Ref: Backup and Recovery , publisher O'Reilly

so can i not use ssh tunnel and implement Ssync with snapshot???

fosiul01Author Commented:
i know ,you know about Rsync with snapshot, but sill here is one website for this

Why can you not establish a VPN from VPS? Each has a static IP? IPSEC remote type VPN limited to a specific set of protocols to a specific set of IPs.

You could setup an ssh tunnel and then direct the rsync through it.
You may need to setup two for each direction if the VPS is the one initiating the tunnel
i.e. one local and one remote. -L and -R since you are using a circular replication.
one of the office mysqls needs to send data through to your.
you can setup per service tunnel.
i.e. connection to localhost:6500 gets you to VPS1:mysql server.

A VPN to the office could be simpler with ssh tunnels between the VPS's

fosiul01Author Commented:

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 8
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now