Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / September 2007



Tip: Looking for answers? Try searching our database.

CFFTP & Multiple Servers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mletson - 21 Sep 2007 17:34 GMT
Hello,

We have one website clustered on two servers.  The servers are cf07 and cf14.  
When a user uploads a file on CF07 and then returns the next day to review the
file, it isn't there!  This is because yesterday, they were on cf07 and today
they happen to be on cf14 (of course, they wouldn't know this).

Problem:  How can I initially upload the file to both servers so that the user
won't have this problem?

I've looked at cfFtp but no luck so far.

Thanks,
Mike
Ian Skinner - 21 Sep 2007 17:41 GMT
There may be other ways to replicate files accross clustered servers.

But the CF solution that popped into my mind is to do a <cffile
action="copy"...> shortly after your <cffile action="upload"...> to
replicate the uploaded file to the other server.

While typing this, I then thought of a common file server.  Is it
possible in your network to have a common file server that both CF
servers are aware up and this is where the files are uploaded.
Ian Skinner - 21 Sep 2007 17:55 GMT
Sorry I just noticed that the file is uploaded with a CFFTP not a
CFFILE, but I think the proposed solutions work the same either way.
mletson - 21 Sep 2007 18:33 GMT
Ian,

Using cfFile between different folders on the same server would be fine but,
I'm talking about physically separate file servers with different IP
addressess.  To my knowledge, cfFile does not allow UNC path conventions (for
example) so I think cfFile will not work.

We do not have a third and common file server.

Thanks,
Mike
Ian Skinner - 21 Sep 2007 18:46 GMT
"To my knowledge, cfFile does not allow UNC path conventions (for
example) so I think cfFile will not work."

<cffile ...> does handle UNC paths just fine, I use them all the time in
my projects.  There is just a bit of configuration required for them to
work, especially on window CF installs.  By default the windows
ColdFusion service runs under the 'localsystem' user and has no
permissions to any network resources.  To use UNC paths one just needs
to create a domain user with the desired permissions and assign the CF
service to run under that user.  And restart the CF service of course.

On UNIX systems CF already runs under a user account so one just needs
to provide that user with the required permissions to the desired
network resources.

With this in place one can easily do things like <cffile action="copy"
destination="\\cf14\a\directory\path\"...>
mletson - 21 Sep 2007 19:07 GMT
Ok.

Our ColdFusion server runs under an account we created called cFusion. In
order to impliment what you suggested, all I have to do is make sure the
account "cFusion" has read / write permissions on the file directories in
question?

Thanks,
Mike
mletson - 21 Sep 2007 19:36 GMT
Ok,

This is what I did:

On each server, I gave the "cFusion" account read and write permissions on the
specific directory in question.
I then did a cfFile action = "copy".  In the destination attribute, I used the
computer name of the server where I want to copy the file to, followed by the
complete path, including file name.

The template didn't throw and error and there is nothing in the logs.  
However, no file.

Thoughts?

Thanks,
Mike
Ian Skinner - 21 Sep 2007 20:38 GMT
You seem to have a fairly robust application, is there any possible of
potential errors being handled by some level of exception processing code?

Can you try a path you know is foobar and make sure an error is actually
displayed?

Also a delay may be required.  In some cases I have heard of when
receiving a file and then immediately trying to move or copy it, the OS
is not done with the first file operation before the second one is fired
by CF.  This can have unexpected behavior.  A few moments of sleeping
may be helpful between the upload and the copy.
Wilgeno - 21 Sep 2007 18:50 GMT
Before we had a single file server that our CF servers all accessed we used to
have this problem.

To compensate we had code that would save the file locally with cffile and
then FTP the file via <cfftp> to the other server.  

The best solution here is a single file server that all of your cf servers can
access.  All four of our CF servers do this now.
mletson - 21 Sep 2007 19:06 GMT
Ok.

Our ColdFusion server runs under an account we created called cFusion.  In
order to impliment what you suggested, all I have to do is make sure the
account "cFusion" has read / write permissions on the file directories in
question?

Thanks,
Mike
cf_menace - 21 Sep 2007 23:18 GMT
We're currently in the same situation you're in. Since we don't have a SAN, my
predecessor used the only shared storage he had at the time: the database.
Rather then upload all the files to a folder, any uploaded document is placed
in the database as a BLOB. When a document is requested, a process checks if
the document exists on the file system. If not, then it retrieves it from the
database and places a copy on the file system. This way subsequent requests
from the same server return the file from disk and not the database.

Thankfully, we're upgrading our infrastructure and our new setup will have a
SAN (plus CF8).

In the meantime,  on Linux I'd have used http://en.wikipedia.org/wiki/Rsync to
keep the folder contents consistent between servers. After a bit of Googling,
I've found one http://www.cis.upenn.edu/%7Ebcpierce/unison/. Might be worth a
look.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.