• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Mirroring MySQL between two VPS with Plesk 12

Silas_Mariusz

New Pleskian
Hi

Few weeks ago I experienced storage issues on my VPS. I made webspace copies manually cos I know ovh's standard line means:
- copy is forbidden and vm umount impossible.

Reported machine came back to me but with few broken files.
That's why I made a copy... Did know the risk.
Their cloud line is acceptable - let's say... But I bought that cheap classic 3 for 12 months o_O

Redundant != copy.
But while runing production services, company webspace like I do, it's needed!
So it would be fantastic feature from Plesk!
Definitely needed!

Is it possible?

Best regards
 
My Mirroring, do you mean MySQL Replication? If so, then you can still set-up MySQL DB Replication without the consent of Plesk!
 
@silas,

I am not completely sure what the exact question is, but I will try to resolve most of the implicit questions.

Backup and restore of mysql databases
Plesk Panel and/or any other common (sql/mysql) tool can be used to create (frequent) backups, that can be restored at will.

A restore of the database can be started in the case of storage, disk and/or server failure.

Mysql cluster
Clustering of mysql database servers is one way of allowing continuity of database presence, irregardless of the nature of the failure.

This solution requires at least two servers (and more is better), with associated costs therefore rising.

Moreover, the associated costs can become even higher when having to set-up and/or maintain the cluster infrastructure yourself.

Percona Cluster is a common open-source solution for mysql clustering, but that does not alleviate all of before mentioned costs.

Another option is to use ClearDB, in order to have a clustered mysql environment, set-up and maintained by the associated company.

However, even that is not a real solution, since databases outages can become costly or even prevent proper working of the database(s).

Mysql mirroring
In a sense, a simple alternative to mysql clustering is what I call "mysql mirroring".

This implies the creation of a very small server or VPS, running an identical mysql server and identical databases.

With some easy (my)sql scripting and/or even rsync, you can synchronize the databases/servers on a frequent basis.

Whenever the master mysql server is going down or encounters data damage, one can switch (manually) to the "mirrored" server.

Note: discrepancies between servers can exist, dependending on the frequency of "mirroring", hence implying that this approach should be viewed as a "dynamic backup".

The obvious advantage, in comparison to a static backup, is that the "mirrored" server can be started up faster, hence reducing downtime and problems thereof.

Also note: with some advanced scripting and usage of drbd, corosync, pacemaker (and similar) the "mirrored" server can become a continuous mirror, that is automatically enabled as the master mysql server, if a failure on the other mysql server occurs. This advanced scripting hence results in a full HA cluster.

The obvious advantage, in comparison to before mentioned full HA Cluster, is that a "mirrored" server approach is more easy and more cost-effective.

Conclusion
In general, it is good to have some kind of backup or mirror or cluster for mysql servers and associated databases.

The proper choice depends on your ability to maintain the solution chosen.

However, whatever the choice may be, Plesk is supporting any choice made, in the sense that Plesk

- can work with external mysql servers, hence not excluding (external) clusters (Percona Cluster for instance) and/or database solution providers (like ClearDB),
- supports various external mysql based servers, such as MariaDB, Percona (and with simple dbases, even MS SQL can be used)
- allows for backups of local database servers, with the possibility of scripting backups
- support that the native (local) mysql database server functions as a master of an external (slave) mysql server

and so on.

In short, the answer to your question is: yes, it is possible, in various ways.

However, the main question should be why to host databases and/or Plesk on a server that breaks down and/or can break down in the future.

In a sense, you want to create a solution for the case that the current server breaks down (again) and you are potentially willing to make costs to create a solution that entails both the current server and a new server (the failover server), while migrating to a new, good and solid server would probably prevent costs of a failover server.

It is my advise to reconsider your current hosting server, instead of emphasizing the desire to have a backup or cluster solution.

After all, without the faulty (current) server, the desire for a backup or cluster solution would be less prominent.

Kind regards....
 
To be honest MySQL mirroring is not enough for me...
I expect something more...

Here is feature suggestion - not really hard to be done.

Something closer to the RAID 1, but not really like a RAID. Let's call this Fail-over Pairs.
Code:
vps-A.node.plesk ----------- pair ----------- vps-B.node.plesk
         |                                             |
webspace-1.vps-A (m) --- lo prio copy --> --- webspace-1.vps-A
webspace-2.vps-A (m) --- md prio copy --> --- webspace-2.vps-A
webspace-3.vps-A (m) --- hi prio copy --> --- webspace-3.vps-A
webspace-1.vps-B --- <-- lo prio copy (m) --- webspace-1.vps-B
webspace-2.vps-B --- <-- md prio copy (m) --- webspace-2.vps-B
webspace-3.vps-B --- <-- hi prio copy (m) --- webspace-3.vps-B
I would like to host 3 webspaces on vps-A and another 3 on vps-B.

(m) - means selected vps is primary and take care of handling that webspace services

Plesk is synchronizing data betwen master and slave webspace:
lo prio - full recheck once a day/24h - no synchronization
mid prio - full recheck once a day/24h - file synchronizing delayed to 1-5 min depends on loadavg
hi prio - rsync real time syncrhonization

Scenario my vps-a is lost for 5 minutes. Admin is getting notified about the issue and vps-b is annoucing it will change DNS services and start serving lost things from vps-a.
Admin has 15minutes to abort auto dns change.

Anyway files can be monitored from inotify:
The inotify API provides a mechanism for monitoring filesystem events. Inotify can be used to monitor individual files, or to monitor directories.
 
@silas,

First of all, you have to be explicit about your definition of "webspace" (that can be anything, but we will assume some general purpose for the time being AND, moreover we will assume that each of the "webspaces" is unique, otherwise your setup would not make any sense).

In general, your solution requires a lot of configuration, manual tweaking and is more or less inefficient with respect to set-up.

The set-up inefficiency can be easily deduced from the facts that you are

a) "creating a system-in-a-system", in the sense that the priorities are "subdividing" each of the two VPS-es, while for the chosen "structure" a three (or more) VPS setup would be more efficient (each VPS is the master for ONE specific webspace, one OR two VPS function as a slave for a ONE specific webspace, with a two slaves being more efficient, given the fact that data is stored across three nodes, hence creating a sort-of RAID5 storage security), even though a clear disadvantage is the cost of two or more VPS and the cost of traffic (in terms of money AND workloads) across VPS-es,

b) "creating priorities as a requirement" for a set-up, while full-blown synchronization with a HA Cluster is more than enough to obtain your goals, amongst others due to the fact that a HA cluster CAN suffice with TWO nodes, with one node being fairly passive (and only become active in case of a failure) and with relatively low traffic overhead.

In short, try the drbd/corosync/pacemaker based solution, in order to create a full-blown HA Cluster (able to run Mysql clusters or any other kind of cluster).

By the way, I do not understand why you should want to create the intended structure on a VPS, since the VPS is just as good as the underlying bare metal server AND the OS AND the hypervisor (i.e. when the server, OS and/or hypervisor is failing, any cluster based on VPS-es is also failing).

Note that the above (i.e. the last "by the way" remark) is very likely to be the cause of the problem you encountered, given the fact that it happens quite often at OVH.

Kind regards....
 
I don't think it is that what I'm looking for...

By the way, I do not understand why you should want to create the intended structure on a VPS, since the VPS is just as good as the underlying bare metal server AND the OS AND the hypervisor (i.e. when the server, OS and/or hypervisor is failing, any cluster based on VPS-es is also failing).
Exactly, when VPS!
Unfortunatelly I bought two OVH Classics... Will consider move them away from OVH to online.net.

Anyway thanks for you time.
But I still think mentioned idea could be a low-budget Fail-over solution.

Best regards
 
@silas,

It still is not clear what the question has to do with Plesk Panel.

If the "fail-over question" concerns Mysql only, just create an out-of-the-box cluster with Percona cluster or use a drbd based mysql cluster (to preserve open-source options).

All you need is two servers, being either VPS and/or dedicated servers.

The database cluster can then be easily attached to Plesk, just by modifying connection strings in the Plesk config settings.

If the "fail-over question" is concerning a lot of different functions, including webhosting, (again) a simple solution can be formed by using drbd (or even automated rsync).

In general, you "overthink" the "fail-over setup".

Moreover, a full set of existing tools and software is already available, use that to your advantage.

In short, I hope you will find what you are looking for.

Kind regards....
 
Back
Top