4

I need to setup a website with load balance to accommodate more visitors,

I've seen on forums that varnish(balance)->apache(web1&2)->mysql(dbserver) is the way to go.

I know how to setup varnish->single webserver->mysql but not two web server to balance,

But how can I go through on synchronizing both web server content realtime? my custom app allows visitors to post files.

Please advise me on how can I configure this?

My setup.

        (internet)
             |
  (load balance server)
            / \ 
           /   \
 (webserver1) (webserver2)
          \     /
     (database server)

thank you.

shinmac
  • 73
  • 1
  • 2
  • 5

3 Answers3

1

If you really need real-time replication of all the files uploaded, you need a distributed file system like GlusterFS or use a DRBD/ocfs2 setup.

Otherwise I would go with csync2 or a simple rsync script.

r_3
  • 886
  • 5
  • 9
0

See Load Balancing with Varnsih or HAProxy. For synching uploaded files, look at creating a network share mounted on both hosts where users can upload files to.

KM.
  • 1,746
  • 2
  • 18
  • 31
0

I would suggest taking a look at csync2 for keeping your web servers in sync. It is designed specifically for the task of keeping clustered hosts in sync, and you can configure it to handle conflicts automatically.

Csync2 was developed for synchronizing configuration files, but I see no reason why you couldn't use it to sync uploaded data as well.

You could, as KM suggested, create a network share (e.g. NFS share), and post all uploads there, but you need to ensure that the NFS server is redundant enough not to take down both web servers should something go wrong.

Ketola
  • 311
  • 1
  • 3