i just rent 3 vps servers with this:
150GB hard disk
6 ip address

so we have vps1, vps2 and vps3 and i'm thinking
distribute the services like this:
VPS1 - frontend
+ DNS Server
+ MySql Server
+ NFS (share files between vps2 and vps3)

VPS2, VPS3 - app servers
+ Apache
+ Lighhttpd (static files)
+ Postfix
+ Dovecot

the vps1 has all files for the applications, php files, js files, css files, html files, etc etc. the VPS2 and VPS3 mount that files over the network.

the vps1 receive a request from the internet, on port (80,110,25) pass the request to VPS2 or VPS3 if data is needed can connect to the mysql server in VPS1

Is a good idea in the VPS1 install HAProxy for balancing the load on VPS2 and VPS3 ?
Can anyone suggest me a better setup , tips or ideas?


closed as too broad by EEAA, mdpc, Katherine Villyard, Tom O'Connor Feb 13 '14 at 10:14

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    One of the benefits of rented virtual machines is not having to make a service smoothie with every server. – Dan Garthwaite Feb 12 '14 at 4:50

We use haproxy to load balance.

You have several glaring points of failure

1) if vps1 goes down, haproxy and all your network mounts break. and mysql breaks....

A better setup would be to:

  1. run keepalived on all servers and share a virtual ip between the three
  2. run haproxy on all servers and have it listen on the virtual ip
  3. run mysql-cluster (data/storage nodes on all servers / management on vps1)
  4. skip NFS and mirror files with rsync or similar to all servers.
  5. each server can run posftfix

I have no experience with dovecot (actually i only have bad..) but i believe it should work behind the virtual ip and haproxy.

With this setup you can lose any 1 server and keep all services up.

If you lose 2 the mysql-cluster will get upset but everything else will work.

  • ps.. you will likelt want to do everything in active/standby until you get relevant session sharing working. – Daniel Widrick Feb 12 '14 at 4:38
  • This is good in theory, but takes a fair amount of technical chops to configure, troubleshoot, and maintain. No offense to the OP, but I highly doubt it's something they can swing, at least not until they have more experience under their belts. I'd recommend starting with something drastically more simple. – EEAA Feb 12 '14 at 4:58
  • hello EEAA, something more simple, can you share your thoughts ? thanks – Alejo JM Feb 12 '14 at 5:31

Most VPS providers also provide load-balancing, SSL offloading, and DNS as a service. Unless your needs are special you will be better off trying to use their services first, replacing them with home grown solutions will only complicate things.

Outbound email is a trivial service that can be installed on all instances as lVlint67 stated.

That leaves just webapp, dovecot, and mysql to be wrestled with behind the scenes. Of course your needs may require dynamic modifications of DNS, dovecot, and smtp, so YMMV.

Not the answer you're looking for? Browse other questions tagged or ask your own question.