2 nextcloud installations, keep files in sync


I am in situation, when I need to mirror my local NextCloud (NC1) files to another server, preferably also NextCloud (NC2). I checked Federation, but thats not exactly what I want - I want behaviour, where I upload file on NC1 and it gets automatically synced to NC2, so it is kind of master-slave scenario.

Is there any guide, or how to do it ? What comes in my mind is rsync…

Short answer No that’s not possible or I should better say, not feasable.

Slightly longer answer: If it’s just for files, you could probably do it with some scripts, but it would still be a pretty hacky way to do it, which I would not recommend anywhere in a production environment.

On the other hand It is absolutely possible to build highly available Nextcloud instances. However, this is probably beyond the scope of this forum. So if you don’t have the appropriate knowlege to do it your self, I would recommend you to contact the Nextcloud GmbH or a professional IT service provider that has experience with load balancers, database clusters, distributed storage etc.

1 Like

Yes you must use two parts:
1.) sync files e.g. with rsync from NC1 to NC2
2.) sudo -u www-data php occ files:scan --all
(on NC2)

documentation occ files

thanks @devnull - thats what I thought.

The story is, I have local nextcloud on the boat, connected with Starlink (so even accessing it from outside is quite hard and not always online), but video editors need to have access all the time. So thats why I want to have it synced to more reliable connection.

Can’t you just sync to an external server (not on the boat) with the sync client? Then it takes some time and can only upload once you have an internet connection. But this way, you transfer the file via satellite only once.

1 Like

the ideal is to be have automated solution, so in cron, I would set up rsync and it would sync files just one time aswell + it is automated. But I guess it would work also as you wrote, set up sync client on other linux server and keep it in sync in “nextcloud” way. Nice.

If the sync client is overkill, you can still keep something with cron and use webdav directly. Not sure how partial uploads are interesting for you and that you can continue such uploads with as little bandwidth usage possible.

Maybe you can use a Nextcloud in the normal internet (search Managed Nextcloud, maybe 5 euros for 500 GB each month) (or your NC2) and use on the the boat the Nextcloud client (e.g. Windows, iOS, Android) were all needed directorys are synced before. And if you need a lot of data synced go to the coast to a cafe with internet, drink coffee :coffee: and sync the data there. You can select each directory manually. All other users do not need the communication to your boat. They upload and download to the normal internet (Managed Nextcloud) (or NC2).

The solution may be less good if you make a lot of changes in your Nextcloud on your boat. For modification on the boat use if possible not the Nextcloud web GUI but the Nextcloud client.

thank you for all answers

1 Like