Replication#
Replication keeps the servers of a cluster the same: a user that is changed on one is changed on the others within a second, and so are jobs, settings and shares. It is what lets any server of a cluster do the work of any other.
This page explains how it behaves. Its settings are described in Preferences, Replication, and the servers that take part are managed in the Cluster section.
Replication needs an Enterprise licence.
What is replicated#
| Kind | Setting | On a new server |
|---|---|---|
| users, groups, inheritance | User Manager changes | on |
| jobs | Job changes | on |
| the settings of Preferences | Preferences | on |
| shares that users make | Shares | on |
| the server's PGP keys | PGP keys | off |
| reports saved as HTML | HTML reports | off |
| files kept in the server's own S3 format | S3Crush protocol | on |
Also carried between the members of a cluster: the access roles and tokens, the key that jobs are signed with, the keys that logins are sealed with, and saved reports and dashboards.
What is not#
| Why | Instead | |
|---|---|---|
| files | replication is about settings, not about data | storage that all servers reach: Shared users and shared storage |
| the ports of a server | each machine has its own addresses | set them on each server |
| the licence | each server has its own | |
| a server's identity and its cluster settings | they describe one machine | |
| what existed before a server joined | replication carries changes | copy it once: Joining a server |
| logins that are open | Session replication |
How it behaves#
- Every server sends to every other. There is no main server: a change made on any server reaches all. Make changes where you like.
- A change, not a copy. When a user is saved, that user is sent. Nothing compares the servers and evens them out afterwards.
- Within a second, normally. The Cluster page shows what is waiting for each peer.
- Changes wait for a peer that is away. A change to users, jobs, preferences or shares is kept, also over a restart, until the other server has confirmed it, and is sent again when that server is back. Other messages that were queued when the link broke are thrown away and counted: Dropped, in the node's detail.
- The last save wins. Two administrators who change the same user on two servers at the same moment end up with whichever save arrived last, on all servers. Replication does not merge the two.
- A change that arrived is applied as it is: the receiving server does not replicate it on again.
By key, or the old way#
Servers can be tied together for replication in two ways:
| By key ("pinned") | The old way | |
|---|---|---|
| who the peers are | the members of the cluster: no list to keep | Peer servers in Preferences, typed in on every server |
| how they know each other | each server's own key: see Trust between servers | the address a connection comes from, and a Shared secret key that all have |
| a new server | joins the cluster with a one-time code, and replicates | is typed into every other server's list |
| the secret on the wire | there is none | sent on every connection |
A cluster starts by allowing both: members replicate by key, and a peer that is not a member is still accepted the old way. That is for moving over without a break.
When every replication peer is a member, close the old way: More, Require pinned replication in the Cluster section.
After this, a server without a valid key cannot replicate with this cluster. The shared secret and the IP list are no longer used.
The page refuses while it would cut somebody off: "Not yet: …", with the reason, such as a peer that is not a member yet. Once on, Preferences shows the old fields greyed out: "Not used: replication is pinned to the servers' keys. The servers replicate with the members of the cluster."
Allow the old way again undoes it: "Allowing the old way again lets servers replicate by address and shared secret once more."
A server that is refused raises the alert Cluster Peer Refused.
Watching it#
| Where | Shows |
|---|---|
| a node's detail, Links: the node detail | the mode, what is Waiting to be sent, and per peer its Queue, Last success and Dropped |
| the node's health | Replication: OK, or what is wrong |
| the alert Replication Peer Unreachable | a peer does not answer |
| the alert Replication Falling Behind | the queue for a peer is growing: changes are made faster than they get there, or the link is too slow |
| the metrics | crushmft_replication_peers, crushmft_replication_pending, crushmft_replication_queue |
| Test Replication Connection in Preferences | asks the peers now and lists what each answers |
A server that was away#
A server that was down for an hour gets, when it is back, what the others queued for it. For a short outage that is everything.
For a long one, or a server restored from an old backup, do not rely on the queue alone: copy the users and jobs over again with Copy users and settings from …, with the switch to replace what exists on both. See Joining a server.
Jobs in a cluster#
Jobs are replicated like everything else, so every server has every job. That each scheduled job runs once, and not once per server, is the cluster's doing: see Jobs in a cluster.
Users in a database or a directory#
Replication of users is for users kept in the server's own files. Where all servers read their users from one outside place, a directory or a database, there is nothing to replicate for them: turn User Manager changes off, and let the other kinds replicate. See Shared users and shared storage.
Files: VFS replication#
A separate feature with a similar name mirrors files from one server to a second one, with a journal for what could not be passed on yet. It is for the rare case of two servers with separate disks. Its settings are in Preferences, Replication. Shared storage is the better answer where it can be had.
Things to know#
- The same version on all servers. Update one at a time, and soon: Updating every server.
- Two sites. Replication works over a slow link; changes arrive later. The round trip of each link is on the map.
- A firewall between servers must let the cluster port through in both directions.
- A DMZ is not a replication peer. It gets what it needs from its server, over its own link.
- CrushFTP 11 peers can replicate with a CrushMFT 27 server the old way while you move over. They cannot be members.