0

I have one machine (centos7) with Apache, PHP, MariaDB and Nginx, Nodejs, MongoDB installed and being used by many different domains.

I'd like to create a working mirror and can't decide between 2 options:

  1. rsync static websites, server and config files + mariadb and mongodb replications
  2. cluster made of 2 machines with some proxmox or other free technology (topic new for me)

I want both of them to serve files , like master-master sync , so they can serve ~50% of requests each.

Would you advise which is more efficient and recommend software/system of your choice ?

knm
  • 5
  • 2

2 Answers2

0

While MariaDB and MongoDB support clustering, maybe it can be the better solution for you. nginx supports different way to dispatch requests, including round robin

It depends of the criticity of your architecture ! :)

Martin
  • 474
  • 1
  • 11
  • I just want to have 2 working copies of websites files and databases. I know how to set DBs replications and rsync files. But if there is easier option to replicate all at once I'd like to learn it. – knm Nov 18 '21 at 13:41
  • Each solution have his own replication solution (I mean commercialy), your question echo the clustering architecture ! :) – Martin Nov 18 '21 at 14:07
  • @knm - Do _not_ rsync files while the RDBMS is running. – Rick James Jan 24 '22 at 02:14
  • @RickJames I just want rsync website files and for MariaDB use its own replication system. But this solution makes this cluster active-passive or master-slave. I am searching for a solution where I can use both machines with round-robin dns. It looks like I always have to use just one machine for adding data and then both for reading data. Is that correct? Or I can set it to use both servers for updating DB and static files ? – knm Jan 25 '22 at 11:59
0

HA with cluster is the only option (from the ones you listed).

Dual-master can lead to unexpected conflicts with unique keys.

rsync will corrupt the database unless you shutdown both source and target. Furthermore, rsync cannot let you write to both Primaries -- it does not know how to do a 2-way sync on database files.

MySQL or MariaDB replication provides some HA. But if the Primary dies, you need to step in and switch to the Replica. Re-establishing the replication after the repair takes some manual effort.

Please do a lot more reading before embarking on HA.

Galera is built into MariaDB, so that might be the easiest route for you. But it is still not "trivial".

Rick James
  • 2,463
  • 1
  • 6
  • 13
  • Is it possible to configure active-active 2 nodes cluster with one machine in US and another in EU ? Like Centos with corosync and pacemaker or DRBD ? Or this type of a cluster can only work connected through local network ? I would like this cluster to be balanced by round-robin. 2 machines - both in sync - both serve websites and store same files and databases. If one goes down , another one works alone. Is that possible ? Reading https://www.amazon.es/CentOS-High-Availability-Mitja-Resman-ebook/dp/B00WX1CWXC right now but the book gives just local network 3 nodes example. – knm Jan 23 '22 at 20:22
  • @knm - Active-active dual-master has a delay of perhaps 100ms. DRBD only protects from disk failure; many other things can fail. A 2-node cluster requires manual intervention to recover from a failure (cf "split brain"). Amazon and other Cloud services to various other magic. – Rick James Jan 24 '22 at 02:08