0

At the moment I have server running with php+mysql+nginx+bind, its a backend system that i have developed for managing set-top-boxes(satellite boxes, iptv,ott boxes), based on clients actions it requires to reach 8 different sub domains online on server, each 8 sub domains does different job, such a authentication, login, API, etc..

Problem that Im facing, there is no backup for this server and everything running on single server, so I have created identical server in different datacenter, and pointed ns2.domain.com as secondary nameserver for this backup server and all dns settings has done.

With this solution, 2 servers need to reach either same database in another location/server, this requires TCP/IP connection instead of using unix sock, and with TCP/IP the latency is getting high in peak time and I have end up with a lot of 404 not found errors due to PHP connections to MySQL.

I havent tested mysql replication, but before that Im wondering few things, like;

in case of primary server is down, clients automaticly reachs to secondary server since its pointed as secondary nameserver for the domain, so far no problem assuming that secondary server has last updated database, let says primary server is up after several hours and many things has been updated on the database;

so whats happening here ? Assuming primary server database is master, will it sync it self with slave database ?

the moment primary server is reachable for the new connections domain will point those clients to ns1.. and database doesnt have the latest updates from slave. ( assuming it will sync it self with slave.)

in this case there will be updates on the master database which slave server doesnt have, because its a new connection for that client and primary server is up and running, so what will happen in this scenario ?

both databases will sync itself with all the changes ? (not so sure!)

with all those questions I end up with seperating Database server, then I faced with many problems of TCP/IP connections which wasnt so good as unix sock connection.

bottom line, I need to find a way of having 2 servers up and running can be placed of eachother as backup.

Db size, 350 MiB

Server has around 200K connections everyday and around 2000-4000 at the same time.

Both servers are very powerfull, 24 cores E5 series cpu, ssd disks and 32 gb rams,

load is not even 5%

thank you in advance for any help.

migrated from stackoverflow.com Dec 25 '16 at 14:56

This question came from our site for professional and enthusiast programmers.

  • Amazon RDS can do this. But you're talking about a lot of work to set something like this up yourself – Machavity Dec 23 '16 at 23:10
  • I was checking Google Cloud SQL before but havent tested yet, again Im wondering of connection latency to database. – Uğur Ekinci Dec 23 '16 at 23:16

Your Answer

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