Replicating an uploaded file from one server to another

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Replicating an uploaded file from one server to another

Post by phice »

How do you guys think i should go along replicating (basically copying) an uploaded file from one server to another (same network I believe) automatically (be it php or another language)? Possibly using PHP's built in FTP functions or something? Basically we've got two servers behind a load balancer and would like to be able to access the file from either server.

Have any of you had this problem or, more rightly named, task?

It'll be on linux servers running through ThePlanet if that helps at all.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

You could either copy it after the upload or have a cron running that does regular rsync type updates. It would depend on your specific application which one would be better.
(#10850)
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

I'm thinking probably an FTP transfer using PHP since it needs to be done immediately.

I'll look into the rsync method as well and post what I do for future reference.
Last edited by phice on Thu May 25, 2006 11:18 am, edited 1 time in total.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

With the ssh extension you can scp too...
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

timvw wrote:With the ssh extension you can scp too...
You can also rsync over ssh -- Tim is right to point out that this should be done securely.
(#10850)
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Now I've got the complete idea for how it's going to be set up.

I've got one linux machine where the uploads will be uploaded onto through an upload box on the website. There are two windows machines that are basically twins and need to have said uploaded file on both servers in the same location. How do you guys suggest I go about doing this? You guys have said Rsync but I have no clue how to set that up on this type of setup.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Google "rsync howto"
(#10850)
Post Reply