Nexcloud server sync

How can I synchronize two nextcloud server together ?

1 Like

Um, what are you trying to achieve specifically? You can share a top level folder as a federated share, and have the contents sync. You could do a remote rsync between the servers and use occ to refresh the local files list. It all depends on what end result you’re after.

I’ve been looking at this too, because if this is ‘cloud software’ it should be highly available etc. I haven’t really looked into Federated share, but this does not feel like what I am trying to achieve - I don’t want to see these as different instances, I consider them all “my nextcloud installation” - I want my images to be available everywhere.
I implemented the ‘rsync + occ files:scan’ method, and it works just fine. In the future it’d be great if this could be part of the product somehow :slight_smile:

This would actually be really cool if you could sync between two servers. Or maybe another way to put it is a federated share with a cached version on the server.

This way all users belonging to the server will download the cached files from there local server and not talk to the external server.
Potentially saving a lot on bandwidth.

It is not possible at the moment. There was a feature request on the owncloud-bugtracker where some points were discussed:

I move this thread to the feature requests.

Hi are there any developments on this feature request. I have two NextCloud servers that I wish to have them sync data and users between them. A kind of redundancy system.

Hm. It depends on your Linux skills (or the willingness to try out), but in the end all technology you need is available on Linux:

  1. create a Corosync / Pacemaker cluster between the two servers (better would be three to avoid having a split brain scenario) ->
  2. Create a DRBD replication between the two servers
  3. Use DRBD to sync all Nextcloud folders (installation and data)
  4. Use DRBD to sync your MySQL folder (you can disable binary logs, if you want to reduce replicated data)
  5. Let pacemaker manage DRBD and MySQL (start only on the node that is currently DRBD master)

If you have both servers on the same internet uplink you can simply add an floating IP to the pacemaker cluster and portforward to that IP on your router / firewall

If you have to different remote locations you need to find a solution to point the request to the current master location (that most likely has a different public IP) but this is highly depending on your possibilities.

This is just an idea for a small setup. If you create something bigger for a lot of users you will have to adapt it to your needs, like using a MySQL / MariaDB / Percona Galera Cluster for Master / Master replication of the DB and something like Ceph for a distributed highly available storage backend for the files.


1 Like

forgot to mention: you could habe something like an nginx reverse proxy always pointing to the current master on both nodes. then you only have to think on how the DNS thing could work (maybe some kind of Dynamic DNS service that is also updated by the current pacemaker master)

@deliarmin thanks for the info. Is there something simpler in terms of a NextCloud App?

Not that I know of …

Hi all and @deliarmin,

the solution with pacemaker/corosync is not not so difficult, may be sometimes a little bit tricky. I ran it on two cubieboards 4 with ubuntu 14.04 for over one year. A short summarize:

2 Cubieboards 4 with a USB3 Harddisk (2,5") for each

GlusterFS for a synchonized volume for the nextcloud data and the database files

Corosync/Pacemaker as clustermanager for
IP address

with this i have a active-passive-cluster. If one node fails, the other take over, or if one harddisk fails, it runs without an issue.

I start with owncloud and run actual NC11.

At least, a small configuration, HA, not expensive for HA, the power consumption is less (ARM).
OK, the performance could be better, but it’s HA :slight_smile:

Regards Breschi

I was looking a way to sync my purchased vps / nextcloud, and my local i setup this week.
One way i did, was to setup a cronjob to rsync the 2 connected folders.
Eventually i will probably end up going with my own server because the bought one can take up to a minute to open the web interface for me.

Normally, you have to sync the database as well. @JasonBayton set up a small cluster but I don’t know how well it would work if there is only a small bandwidth link between the servers

Hi, cloud you please look at this question ?