0

I am operating a centos linux server(A) and I want to create a realtime backup server(B) so whenever server A goes down server B(after the failover kicks in) will take over. I already solved the failover thing(tip: I used Cloudflare) and I am looking for a solution to "mirror" my server A files and databases to server B.

I used rsync and mysqldump through crons but its not realtime plus its resource intensive because it transfer all files and database content every time.

2
  • For search purposes, you're better off with "high-availability" than "backup server". A backup server is a thing, but it's not this thing. Sep 6 '15 at 12:19
  • Using rsync for the static files won't transfer everything every time. You can use mysql replication to deal with the databases. Running mysql on different servers from the app servers would be a nice bonus.
    – chicks
    Sep 6 '15 at 12:28
1

It depends on your particular requirements. For example, if the application isn't resource intensive you could perhaps go virtual and use VMWare Fault Tolerance. If resource intensive and/or physical you should probably look at DRBD.

Hope this helps.

2
  • Thanks! Its more or less resource intensive. I did find similar replies here @serverfault for using DRBD and its an option I am thinking about even though completely stranger to it.
    – makmour
    Sep 6 '15 at 14:15
  • DRBD is the correct solution here.
    – womble
    Sep 6 '15 at 22:18
0

You're going the wrong way about this. What you want to achieve is some sort of HA (high availability). I suggest you look into HAproxy. With its simple configuration, that's all you really need, there are plenty of tutorials out there.

You can have two servers as the backends, and they can even share the load between themselves. You sync the files that can be synced without locking (for example non-db stuff) with lsync.

In case you're not hosting WWW stuff with the servers, but need high availability, HAproxy can also load balance plain old TCP connections, it has various modes of operation.

  1. Place the two servers behind the load balancer
  2. Create a master-master replication between the two DB instances if possible (IE, if you're talking about MySQL), or a simple master-slave, where you can promote the slave whenever necessary. The DB is always in sync.
  3. Sync the non-db files realtime with Lsync. Since you mentioned Cloudflare, it probably is web-based.

I'm using HAproxy a lot, and it's a brilliant piece of software, simple to configure and very robust. This is the best way to go with it. Take a look at this simple tutorial at Digitalocean to see what it's all about.

3
  • I hug haproxy every day, but you didn't address the core of the question which was synchronization.
    – chicks
    Sep 6 '15 at 12:29
  • Doesnt load balancer mean that if the main server fails then the other server wont work as well?
    – makmour
    Sep 6 '15 at 14:16
  • I did actually address the synchronization, Lsyncd and master-master setup, or something similar, depending on the DB used. The load balancer will have to be placed elsewhere, of course.
    – Vladimir
    Sep 7 '15 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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