• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFFTP & Multiple Servers

New Here ,
Sep 21, 2007 Sep 21, 2007

Copy link to clipboard

Copied

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
TOPICS
Advanced techniques

Views

742

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 21, 2007 Sep 21, 2007

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 21, 2007 Sep 21, 2007

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 21, 2007 Sep 21, 2007

Copy link to clipboard

Copied

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. Also, I am uploading the initial file using cfFile.

Thanks,
Mike

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 21, 2007 Sep 21, 2007

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 21, 2007 Sep 21, 2007

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 21, 2007 Sep 21, 2007

Copy link to clipboard

Copied

"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\"...>



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 21, 2007 Sep 21, 2007

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 21, 2007 Sep 21, 2007

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 21, 2007 Sep 21, 2007

Copy link to clipboard

Copied

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.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 21, 2007 Sep 21, 2007

Copy link to clipboard

Copied

LATEST
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 rsync to keep the folder contents consistent between servers. After a bit of Googling, I've found one Windows program that does the same thing. Might be worth a look.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation