A standby server for WordPress: database and files
If you host WordPress sites for clients, a nightly backup answers the question of what you can restore. It does not answer how long the sites are down while you restore it. A second server that already holds everything does.
Two things have to arrive
A WordPress site is a database and a directory. The orders, posts and settings are in MariaDB. The uploads, themes and plugins are files. A standby with the database and without the uploads shows pages with broken images; one with the files and an old database loses yesterday's orders.
The database: never more than a moment behind
ZeroBehind drives MariaDB's own GTID replication. Every transaction the master commits is sent to the replica at once. The console shows how many transactions the replica is missing, and the usual answer is zero.
The whole server is replicated: every site's database, including the ones you add next month.
The files: every few minutes, to the same path
You choose the directories, for example each site under /var/www. The replica pulls them from the master every 5, 15, 30 or 60 minutes, through the same encrypted channel, to the same path. Owner, permissions and times are kept. Caches, logs and upgrade leftovers are left out by default.
The console shows when each directory was last copied, how big it is and how every run went. Before a planned role switch the files are copied once more, so the new master starts with what the old one had.
What protects the copy
A tool that mirrors files will also mirror a mistake. These stops are built in:
- What is removed on the master goes to a bin on the replica and stays there for 14 days.
- A directory that suddenly looks empty on the master, as an unmounted disk does, stops the run instead of emptying the copy.
- When a large share of the copy would disappear in one run, the run stops and asks you first.
- Below a site's directory no symbolic link is followed, so a compromised site cannot make the agent write somewhere else.
The day you need it
For planned work you switch roles: 3.5 seconds, with a pause for the application of under half a second on our own pair. After a failure you confirm the takeover, and the console tells you how many transactions may not have arrived and what time the files are from. Then you point the sites to the second server.
It is a standby, not a backup. Keep your backups: replication copies a deleted post as faithfully as a new one.
Want to see it on your servers?
Tell us what you run. We answer with what is covered and what is not.
Talk to us