Dear All,?? Background information:? i have a cluster of 14 apache servers running behind a load?balancer?.hits to the server are random, there's no master webserver so uploads to the website may land on app server 1..14 depending on where it landed by the load balancer. What i need help with: i want to have all the "uploaded files" in all webservers to be in sync.here's a scenario: 1. User uploaded file1.txt to the site(names are unique), where it landed on app server 1.2. Same user visits the site the next day and his hit lands on app server 3 that informs the user that there's no such file as file.txt What i've tried: 1. as a cron: for i in {1..14};do rsync -av /source/uploaded/dir/ user at 192.168.5.$i:destination/uploaded/dir/;done?on all 14 servers. 2. uploaded file1.txt and made sure it lands on webserver1 and the same file1.txt with a minor change that landed on webserver 3. Result: 14 webservers?received?only the oldest file instead of propagating the new one. Can anyone put me on the right track with tihs? Best, --Roland?
Christopher Hawkins
2012-Feb-13 13:52 UTC
rsync ing files within an apache cluster - newbie
I would try using inotifywait to call rsync only when new files appear. That way the new files cannot get overwritten by the old files. On 2/13/2012 7:13 AM, Roland RoLaNd wrote:> Dear All, > Background information: > i have a cluster of 14 apache servers running behind a load balancer .hits to the server are random, there's no master webserver so uploads to the website may land on app server 1..14 depending on where it landed by the load balancer. > What i need help with: > i want to have all the "uploaded files" in all webservers to be in sync.here's a scenario: > 1. User uploaded file1.txt to the site(names are unique), where it landed on app server 1.2. Same user visits the site the next day and his hit lands on app server 3 that informs the user that there's no such file as file.txt > > What i've tried: > 1. as a cron: for i in {1..14};do rsync -av /source/uploaded/dir/ user at 192.168.5.$i:destination/uploaded/dir/;done on all 14 servers. > 2. uploaded file1.txt and made sure it lands on webserver1 and the same file1.txt with a minor change that landed on webserver 3. > > Result: > 14 webservers received only the oldest file instead of propagating the new one. > > > Can anyone put me on the right track with tihs? > Best, > --Roland > >
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 You want --update to make sure that it is the newest version of the file that gets propagated. On 02/13/12 07:13, Roland RoLaNd wrote:> > Dear All, Background information: i have a cluster of 14 apache > servers running behind a load balancer .hits to the server are > random, there's no master webserver so uploads to the website may > land on app server 1..14 depending on where it landed by the load > balancer. What i need help with: i want to have all the "uploaded > files" in all webservers to be in sync.here's a scenario: 1. User > uploaded file1.txt to the site(names are unique), where it landed > on app server 1.2. Same user visits the site the next day and his > hit lands on app server 3 that informs the user that there's no > such file as file.txt > > What i've tried: 1. as a cron: for i in {1..14};do rsync -av > /source/uploaded/dir/ > user at 192.168.5.$i:destination/uploaded/dir/;done on all 14 > servers. 2. uploaded file1.txt and made sure it lands on webserver1 > and the same file1.txt with a minor change that landed on webserver > 3. > > Result: 14 webservers received only the oldest file instead of > propagating the new one. > > > Can anyone put me on the right track with tihs? Best, --Roland > >- -- ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~ Kevin Korb Phone: (407) 252-6853 Systems Administrator Internet: FutureQuest, Inc. Kevin at FutureQuest.net (work) Orlando, Florida kmk at sanitarium.net (personal) Web page: http://www.sanitarium.net/ PGP public key available on web site. ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk85MQsACgkQVKC1jlbQAQceqgCfWTt7715J81+l3CBMuXZsAT9i ZpQAn0H3qUE9qSaU7TSiLGK8qDEn+Al6 =cndA -----END PGP SIGNATURE-----