# High Availability



## jcaleb (Jun 20, 2013)

I wish someone will post tutorials for high availability


----------



## MannDude (Jun 20, 2013)

I'm sure someone will now.


----------



## ChrisM (Jun 20, 2013)

Tutorial for High Availability. 

1) Install hardware

2.) Rack Server

3.) Power on server

4.) Install OS

5.) Pray


----------



## concerto49 (Jun 20, 2013)

Chris Miller said:


> Tutorial for High Availability.
> 
> 1) Install hardware
> 
> ...


6) Unplug it from the network.


----------



## drmike (Jun 20, 2013)

7) Backup the backups

8) Don't use SolusVM 

9) Avoid 2GB @ $2+ month VPS companies.


----------



## wlanboy (Jun 21, 2013)

Well there are basically two options:


Misuse DNS
Use two rocket solid boxes with HAproxy
to forward you visitors to one of at least three vps that run your website.


----------



## kaniini (Jun 21, 2013)

wlanboy said:


> Well there are basically two options:
> 
> 
> Misuse DNS
> ...


there are additional options, such as IPVS.  it depends on what network layer you need high availability at.

people should look at Pacemaker and coroSync, see http://clusterlabs.org/ for more information -- it's what is used for serious clustering on Linux these days.


----------



## drmike (Jun 21, 2013)

DNS is the cheapest, easiest, lightest, and top layer really to deal with pointing users to alive servers as they move/fail.

Clustering isn't something normally able to be done on a low RAM style box.

DNS level failover should suffice for most folks.  Once you get big enough to outgrow that, you should be on dedicated servers and clustering becomes an option

On the low spec boxes really able to create a HA environment with Nginx + DNS + monitoring. 



wlanboy said:


> Misuse DNS Use two rocket solid boxes with HAproxy



Redundancy would be 3 HAProxy servers.   Gets expensive quick and multiplies where geography requirement included.

DNS misuse?  Probably, unsure of the specification a solution like Rage4 + monitoring for failover violates, but it works.

I will *probably* start a thread in tutorials on DIY simple redundancy over the weekend.  Hopefully others can recommend equally as simple pieces / howtos.


----------



## jcaleb (Jun 21, 2013)

For example, website. MySQL replication is easy, tons of tutorials to do master master. How about file synching?


----------



## drmike (Jun 21, 2013)

jcaleb said:


> MySQL replication is easy


Yeah a MySQL replication piece on here wouldn't be bad   It's a feature, but way too few folks use it and syncing multiples like 6 severs, well, can MySQL reliably do that  ?

File syncing is a cinch per se.  That's a straight rsync with cron event.


----------



## jcaleb (Jun 21, 2013)

buffalooed said:


> Yeah a MySQL replication piece on here wouldn't be bad   It's a feature, but way too few folks use it and syncing multiples like 6 severs, well, can MySQL reliably do that  ?


2 synching is fine with me =)



buffalooed said:


> File syncing is a cinch per se.  That's a straight rsync with cron event.


but you dont which which of the 2 servers has an update of file?


----------



## drmike (Jun 21, 2013)

jcaleb said:


> 2 synching is fine with me =)
> 
> 
> but you dont which which of the 2 servers has an update of file?


No doubt, keeping the files sync'd requires thoughts and strategy.

If we have 6 nodes that run everything front to back (Nginx, MySQL, file replication, MySQL replication) then each location is autonomous.

The price for creating this "efficient" pack of services is the sync'ing no doubt.  Options are to put files inside database or at least tracking of them in there or a distributed filesystem.  Those are the cleanest options.

I do some DIY rolling of a hybrid of this sort of.  If you have files that aren't getting updated --- like re-wrote with next data appended within the same filename, then it's easier for sure.

For instance, a user uploads a photo.  If the user edits the photos and reuploads or edits within the site, scripts should be placing that new version in a new named file.  That's how I build my own solutions.

You can do a roll down to see if file exists locally then use reverse proxy to make the request to the other remote nodes until a file is located too when things are out of sync on disk files.

I think the first step for a redundancy tutorial would be covering a mostly static website.  Basic concepts


----------



## fileMEDIA (Jun 21, 2013)

Cheap HA is easy, we done it for a few customers:

2x Haproxy VMs + virtual ip with VRRP 

3x Percona MySQL Cluster VMs

3x or more nginx webservers

Build a haproxy master+slave setup with a virtual ip and VRRP. Create a MySQL master+master with percona and create a haproxy zone for your mysql cluster with each node. Then install 3x VMs with nginx and sync the filesystem with glusterfs. Create a haproxy zone for your webservers and add each node to it. All VMs located on different nodes. And then you are finished.

If you need a fully ha, deploy this setup in another location and sync MySQL and the filesystem between this zones.

If anyone need some setup, contact us, we can do it for you


----------



## peterw (Jun 21, 2013)

The DNS solution sounds good. If I would run my own DNS servers it will be quite easy to update DNS and to setup low TTL. Am i right? How much traffic does a DNS server create? Do I have to secure a DNS server?


----------



## threz (Jun 21, 2013)

fileMEDIA said:


> Cheap HA is easy, we done it for a few customers:
> 
> 2x Haproxy VMs + virtual ip with VRRP
> 
> ...


Would you mind going into a bit of detail on your setup? Specifically, how did you set up VRRP? Is it something the host has to configure, or a special request?


----------



## RyanD (Jun 21, 2013)

buffalooed said:


> Yeah a MySQL replication piece on here wouldn't be bad   It's a feature, but way too few folks use it and syncing multiples like 6 severs, well, can MySQL reliably do that  ?
> 
> File syncing is a cinch per se.  That's a straight rsync with cron event.


Natively? No 6-way master is impossible. You could do it with MySQL clustering, but that is on the commercial product.

If you want N-way MySQL clustering and scynronus writes you can check out the Galera project  http://codership.com/content/using-galera-cluster


----------



## RyanD (Jun 21, 2013)

threz said:


> Would you mind going into a bit of detail on your setup? Specifically, how did you set up VRRP? Is it something the host has to configure, or a special request?



That is massively over-complicating what should be a relatively simple setup  With Linux-HA you can do failover IP as long as you are contained within a vlan, regardless of what your host does.


----------



## EarthVPN (Jun 21, 2013)

High Availability Solutions for Mysql and Oracle:

http://www.continuent.com/



> Continuent is a leading provider of database-as-a-service solutions for MySQL and Oracle. Continuent Tungsten allows enterprises running business-critical MySQL applications to affordably achieve business and revenue continuity through Tungsten's commercial-grade high availability (HA) and globally redundant disaster recovery (DR) capabilities. Continuent Tungsten makes it simple to create new data services (database-as-a-service) in the cloud or in your private datacenter, and to manage them all from a single point.
> 
> Tungsten Replicator, released under a GPL V2 license, is a high performance, open source, data replication engine for MySQL and Oracle. Tungsten Replicator has all the features you expect from enterprise-class data replication products but with the flexibility of open source. Tungsten Replicator is also one of the core components of Continuent's database-as-a-service solution, Continuent Tungsten. The clustering by Continuent Tungsten provides high availability and disaster recovery, whereas Tungsten Replicator transfers events from one server to another. For full comparison, see Feature Matrix.
> 
> ...


----------



## threz (Jun 28, 2013)

RyanD said:


> That is massively over-complicating what should be a relatively simple setup  With Linux-HA you can do failover IP as long as you are contained within a vlan, regardless of what your host does.


To do any IP failover, don't you need a "Virtual IP" assigned to you somehow? How would another VPS take over an IP that's been assigned elsewhere?


----------

