Announcement

#1 2014-01-24 07:50:36

CaptSpify
Member
2014-01-24
2

[resolved] Load Balancing

I have installed piwigo in two servers behind haproxy. This means that if one of my web-servers goes down, all new connections fall over to my secondary web-server.

This causes issues with piwigo.  If my primary server goes down, the second one never displays the pictures that I've uploaded to my primary.

These two web-servers share a mysql server, so the picture's name, folder, etc all show up just fine when I have a fail-over. The picture itself doesn't show up. I get the error with the exclamation mark (themes/default/icon/errors_small.png).

I'm guessing, that piwigo uses some kind of cache or thumbnail-generation to display these, and since the picture was uploaded to my primary server, the cache-path or thumbnail-path doesn't exist on the secondary server. This is all a guess though.

Is there a way that I can sync the servers so that the picture shows up on both? Maybe there is a directory or something?

If that won't work, is there possibly a thumbnail-generation script I can run every five minutes that will look for new files?

Thanks a lot!

Let me know if more info is needed!

Offline

 

#2 2014-01-24 09:06:17

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: [resolved] Load Balancing

Hello

It's not a problem of cache
It is just that images files are stored in the first server, and can't be accessed by the second one (relative links in the database)

I'm absolutely not a expert but I think you could use the third server dedicated for storage (raid1 or more, etc) and shared by both servers (with a symlink on "upload" directory)

Ask plg (creator of piwigo.com) about he managed his infrastructure

Offline

 

#3 2014-01-24 09:36:22

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: [resolved] Load Balancing

Make your life simple: rsync every 10 minutes.

How big are your directories "upload" and "galleries"?

Offline

 

#4 2014-01-24 13:06:39

Eric
Former Piwigo Team
VALENCE (FR)
2005-03-25
1768

Re: [resolved] Load Balancing

mistic100 wrote:

I'm absolutely not a expert but I think you could use the third server dedicated for storage (raid1 or more, etc) and shared by both servers (with a symlink on "upload" directory)

Correct but working only if the storage is set as a "cluster volume storage" (CSV) and the 2 web servers are set into a cluster (NLB for load balancing).

If not, if web server 1 goes down only on web services (sill responding to a ping command), web server 2 can not know he has to wake up and take the storage resource at his own. Storage resource will stay attached to the first server.


Well... That's what I did in my compagny but with a cluster of MS Windows machines. Don't know if it's the same for Linux  ;-)

Offline

 

#5 2014-01-25 11:20:32

CaptSpify
Member
2014-01-24
2

Re: [resolved] Load Balancing

Actually, they're already stored on a shared drive. I apologize for forgetting to mention that in my original post.

But I didn't realize that pictures were stored in the "_data" directory. I've now pointed my upload directory to the shared storage, and everything works!

Thanks!

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact