0

i just rent 3 vps servers with this:
4GB RAM
150GB hard disk
2 CPU
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
+ PHP
+ 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?

thanks

Alejo JM
  • 204
  • 3
  • 9

2 Answers2

1

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.

Daniel Widrick
  • 3,488
  • 2
  • 13
  • 27
  • ps.. you will likelt want to do everything in active/standby until you get relevant session sharing working. – Daniel Widrick Feb 12 '14 at 04: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 04:58
  • hello EEAA, something more simple, can you share your thoughts ? thanks – Alejo JM Feb 12 '14 at 05:31
1

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.

Dan Garthwaite
  • 2,962
  • 1
  • 19
  • 31