2 Resourcespace server pointing to one filestore

207 views
Skip to first unread message

neel bhatt

unread,
Dec 28, 2016, 7:48:00 AM12/28/16
to ResourceSpace
Hello,

As per our requirement, we are having 2 servers for load balancer that is why we have installed resource space on both.

We are able to point both resourcespace to one common database but pointing both resourcespace server to one common filestore is getting tough day by day. 

We are thinking to use filestore of server 2 so we have created symbolic link on server1 filestore to point to server2 filestore but it is not working.

Also tried giving server2 usl in storageurl but it does not work.

Is there anything we can do here then please help. We are having windows servers.

Thanks,
Neel

Dan Huby

unread,
Jan 2, 2017, 8:06:07 AM1/2/17
to ResourceSpace
Sorry, I don't think there should be any issues with this. My guess is it's just an issue with the way you've remotely mounted the filestore - permissions perhaps?

To rule out ResourceSpace you could create a very simple PHP script that writes a file to the remote filestore. If that doesn't work you know the problem relates to the mount, not ResourceSpace.

ResourceSpace is very easy to load balance - as long as both instances are pointing at the same filestore and database, and have the same config.php, it should all work well.

Dan

neel bhatt

unread,
Jan 2, 2017, 8:20:49 AM1/2/17
to ResourceSpace
Thanks Dan, Can you please give me link to somewhat similar example?

Dan Huby

unread,
Jan 2, 2017, 1:22:50 PM1/2/17
to ResourceSpace
For the PHP script?

Something like:

<?php
file_put_contents("/path/to/remote/filestore/folder/foo.txt","Some sample text");
?>

It should create the foo.txt file.

Dan
Message has been deleted

neel bhatt

unread,
Jan 3, 2017, 6:03:14 AM1/3/17
to ResourceSpace
Actually I asked for having file store on single location for 2 instance of resource space.

Your first answer helped me and I managed to have same config for both servers which means same scramble key for both the instances.

Whenever image is uploaded on serverA, we want it to be stored on server B files store.

For that we made server B filestore sharable and also tried creating virtual directory for filestore on server B.

Below is what I have in config for server A:

$storagedir="http://ServerName/resourcespace/filestore"; //Thus does not work as we are getting error upon upload
$storageurl="http://ServerName/resourcespace/filestore"; // This works fine as it tries to look for images in this location

So whenever above config is there and whenever image is uploaded on server A then below error comes:

We even tried having symlink on serverA filestore to redirect it to remote server but again error is coming without any popup.


Can you please help?

Allison Stec

unread,
Jan 3, 2017, 8:18:45 AM1/3/17
to resour...@googlegroups.com, neel bhatt
$storagedir should be a local file path to the filestore directory and not a url (that’s what $storageurl is for).

Dan’s right, it sounds like your web user on server A lacks enough permissions to use the symlinked filestore. This can happen if you’ve include incorrect user settings in your mount command, by placing the symlinked filestore in a location that server A’s web user can’t actually access, or by the symlink itself having restrictive permissions for the web user. Did you try is test? It will test for correctness of what you’ve asked for and the test should be run on server A.
--
ResourceSpace: Open Source Digital Asset Management
http://www.resourcespace.org
---
You received this message because you are subscribed to the Google Groups "ResourceSpace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to resourcespac...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

neel bhatt

unread,
Jan 3, 2017, 9:08:05 AM1/3/17
to ResourceSpace, neel.b...@gmail.com
Thanks Allison for replying. 

Yes I did check for permission of symlink on server A and it has "Everyone" and IIS user are added for creating symlink. And when I click on symlink, it takes me to another server(serverB) where I have filestore located.

When I give d:/filestore for storagedir then it works for serverA but as we want it to be redirected to remote server, I have created symlink on d:/filestore to \\serverB\filestore.

But upon uploading error is still there and in console it has as below:

I am not able to make any sense by looking at stack trace as it has some wrappers around.


Is there any other way to achieve this?

Allison Stec

unread,
Jan 3, 2017, 9:10:45 AM1/3/17
to resour...@googlegroups.com, neel bhatt
It looks like you’ve got other js errors in your console that happen before the one you shared. There might be useful info there…

Did you try running Dan’s test?

neel bhatt

unread,
Jan 3, 2017, 10:14:34 AM1/3/17
to ResourceSpace, neel.b...@gmail.com
Above is the only error I got after uploading. And I tried what Dan said but it is doing nothing.

Below is the script I added:

<?php
file_put_contents("http://servername/resourcespace/filestore/foo.txt","Some sample text");

echo "Done";
?>

above link is accessible when I put it in browser but above code is not writing anything in file.

Allison Stec

unread,
Jan 3, 2017, 10:29:02 AM1/3/17
to resour...@googlegroups.com, neel bhatt
Where did you place the script?
Did you run the script from a browser or from a command line?

You can also get a visual output of the script by replacing this line:

file_put_contents("http://servername/resourcespace/filestore/foo.txt","Some sample text");

…with this:

$success=file_put_contents(“http://servername/resourcespace/filestore/foo.txt”,”Some sample text”);

if($success===false){echo “Failed!”;}


Then, remove the foo.txt file from the filestore and try again. This script should create the file and then write you text in. If it fails to do either of these or shows ‘Failed’ in the script output you’ve probably got permission issues.

neel bhatt

unread,
Jan 4, 2017, 3:44:25 AM1/4/17
to ResourceSpace, neel.b...@gmail.com
Hey Allison, I wrote above code in notepad and ran it on browser after putting it on IIS folder.

I wrote the code suggested by you and it is returning "Failed" for both the cases you mentioned. I have given "Everyone" full rights on remote server but still do not know what is wrong.

If you were at my place and if you have 2 instances of resourcespace and you are told to have single filestore on only one server then what would you do?

Thanks,
Neel

neel bhatt

unread,
Jan 4, 2017, 5:10:16 AM1/4/17
to ResourceSpace, neel.b...@gmail.com
I wrote below code in script and it returned permission denied error:

$fp = fopen($file, 'a+'); //Where $file is D:/filestore which has symlink to another remote server
if ( !$fp ) {
  echo 'last error: ';
  var_dump(error_get_last());
}
else {
  echo "ok.\n";
}

Error I got it as below:

failed to open stream: Permission denied in C:\inetpub\wwwroot\test.php on line 31 last error: array(4) { ["type"]=> int(2) ["message"]=> string(69)

Which clearly means I do not have permission to access folder which has symlink to shared folder.

Is there anyone who knows how to give full permission to allow above operation?

And below question still remains active if anyone can answer please?

If you were at my place and if you have 2 instances of resourcespace and you are told to have single filestore on only one server then what would you do?

Thanks,
Neel

Derek Broughton

unread,
Jan 5, 2017, 9:55:35 AM1/5/17
to ResourceSpace
On Tuesday, January 3, 2017 at 11:03:14 AM UTC, neel bhatt wrote:

Below is what I have in config for server A:

$storagedir="http://ServerName/resourcespace/filestore"; //Thus does not work as we are getting error upon upload
$storageurl="http://ServerName/resourcespace/filestore"; // This works fine as it tries to look for images in this location

So whenever above config is there and whenever image is uploaded on server A then below error comes:

Surely "storagedir" has to be a path on the server, not a URL? 
Reply all
Reply to author
Forward
0 new messages