Mirroring for easy redundancy / disaster recovery

This is a recurring topic, but nonetheless I was not able to find a simple solution.

I want to set up a Nextcloud on a Nas at home, and one one some remote server, which I would pay for. I want each to be a copy of the other for disaster recovery. The idea is that if I lose access to either the Nas or the remote server, I still have the other one available, and will have time to replace the failed one.

I thought that would be a basic feature of Nextcloud, but apparently it’s not, or I have not been able to find it. All discussions about this issue are some years old, which maybe means there is some recent feature that makes it possible, is that the case?

If not, the only suggestions I found that does not require various forms of hacking is using Rclone. Is that the way to go?

Hey @fpoto welcome to the nextcloud community :waving_hand:

that would be the simplest method of cloning data between instances ensuring the data “database aware” on both instances.

Note :red_exclamation_mark: that would not include data like addressbooks and calendars which would need to be exported and imported manually unless you’re capable of scripting the export and import for automation.

why? nextcloud was designed to prevent data-duplication.

consider an alternative; use rclone to copy/sync only raw data to NAS via sftp or webdav.

if you’re going to set up an instance at home, consider self-hosting only… that way your data is right where you want it, on the NAS at home and you wouldn’t need to pay for a service at all. no need for duplication, no need for cloning, just one instance!

I am lost. Why do you speak of alternative? Isn’t this the standard way to mirror a Nextcloud instance using Rclone?

I plan to set up an instance at home plus a remote instance. They would be mirrors of each other for disaster recovery.

Keeping a single instance would leave my data inaccessible or worse corrupted or lost in the event of crash, theft, fire, flood (for the local instance) or end of business, missing network, authority seizure (for the remote instance).

That’s what backups are for.

If this is about availability in case such an event happens, then you need to decide how much it would actually cost you if your instance were down for a few hours or, worst case a few days. I’d say for personal use, any kind of high-availability setups are usually not worth the effort.

More importantly, this won’t replace proper backups! You still need a solid 3-2-1 backup strategy if you really care about your data.

If this is for home/personal use, I would recommend hosting one instance at home, making backups to a local secondary server/NAS or an external drive for quick recovery, and having an additional offsite backup in case of a catastrophic event like a flood, fire, or theft.

Or you could do it the other way around, of course. Hosting your instance externally and then letting your NAS pull backups from that external instance.

EDIT: And it probably also doesn’t hurt to keep your most important data stored on one or more encrypted external drives, so you still have access to it in the event of a disaster. For home users, that usually isn’t a huge amount of data, as you typically won’t need access to things like recipes, photo collections, or movies if your house has burned down. But you will want access to things like your password vault, in order to log in to your insurance company’s account or your banking accounts.

Either way, in that kind of disaster scenario, I personally wouldn’t want to solely rely on a DIY, glued-and-taped “high availability” setup. :wink:

we’re talking raw data here not Nextcloud instance!

@fpoto j Just a quick note on that:

No, it’s not the standard approach, and no, there’s no simple, out-of-the-box way to clone an entire Nextcloud instance. You can build database and storage clusters and put them behind load-balanced web servers, but that’s mainly about handling high load and ensuring availability—and it’s definitely not something you set up with just a few clicks.

Yes, in theory you could use tools like rclone to sync your files to a second Nextcloud instance. You could even include calendar and contact backups as files, for example if your phone app is configured to export those. That would at least give you access to your files and those backups in a disaster scenario, e.g. if your primary instance is gone.

However, this is not a complete backup. Things like user accounts, configuration, and app data are stored in the database, and you can’t replicate that database to a second Nextcloud instance via rclone.

You could of course use rclone to transfer a database dump as a file to a second Nextcloud instance, which could help you rebuild your primary system in a disaster scenario. But that still wouldn’t give you an actual clone of your first instance that you could use fully interchangeably with it.

In such a setup, the second instance would really just be acting as a file backup target. And even then, you’d still need to configure the backup with proper retention/versioning, because a simple sync is not a backup, i.e. if you delete something on your main instance, it will also be deleted on the target during the next sync.

Generally I would recommend using Nextcloud AIO and configuring remote backups. Then you can in the case of a catastrophic failure spin up a new AIO instance on a new server and restore the whole instance from the remote backup with just a few clicks basically in a matter of minutes.

@fpoto there are other methods such as cold-standby or hot-standby redundancies which must be configured with third party tool set like LXD/LXC, see my WOL cold standby setup SCUBA’s Nextcloud snap server setup & specs which is really overkill, but nice! of course that would require self-hosting.

Generally though, if you’re hosting an instance somewhere you’ll only be able to copy/sync raw data via tools like rclone which amounts to something like duplication and will require additional backup with limited data loss in the case of disaster.

Or ZFS replication in Proxmox VE. :slight_smile:

@fpoto Basically, with these kinds of solutions you move the replication from the application level down to the virtualization or filesystem level, using full KVM virtualization or container-based virtualization, and then replicate the entire VM disk or container.

If you want to do this to an offsite target, you then of course also need equivalent infrastructure on that offsite location. A simple web hosting or a managed Nextcloud won’t cut it. Typically you’d need at least a VPS, and for ZFS replication in Proxmox VE, ideally a dedicated server, which is of course significantly more expensive than just a Nextcloud hosting.

I’d say it’s generally not worth it for home users, and let me repeat: none of this replaces proper backups!

Thanks everyone about the food for thought. I’ll ruminate about what you wrote and, unless I give up, I’ll come back with more questions. I appreciate your help and I think that the material you provided can be precious in any case to people looking for a domestic and reliable long-term solution.