# High availability overview

One server is one machine that can fail. This page is about running CrushMFT 27 so that a failed machine does not stop the service: which shapes there are, what each needs, and where each part is described.

## The words

| Word | Is |
|---|---|
| **server** | a CrushMFT with users and settings. Also called an internal server. |
| **DMZ** | a CrushMFT that stands in the outer network, has no users and no files of its own, and passes everything to a server behind it |
| **node** | a server or a DMZ that takes part |
| **cluster** | servers that know each other by their keys and keep each other up to date, with their DMZs |
| **replication** | changes to users, jobs and settings made on one server are passed to the others |
| **ServerBeat** | several servers share one IP address; one of them holds it, and another takes it over when that one fails |

High availability needs an Enterprise licence.

## The shapes

```
1  one server, DMZs in front         2  two or more servers

   +-------+   +-------+                +----------+       +----------+
   | DMZ 1 |   | DMZ 2 |                | Server A |<----->| Server B |
   +---^---+   +---^---+                +----------+       +----------+
       |           |
     +-+-----------+-+
     |    Server     |

3  servers with DMZs                 4  servers sharing one address

   +-------+        +-------+           the servers of 2 or 3 share one IP
   | DMZ 1 |        | DMZ 2 |           with ServerBeat: users always reach
   +---^---+        +---^---+           whichever holds it
       |                |
   +---+------+   +-----+----+
   | Server A |<->| Server B |
   +----------+   +----------+
```

A server always opens the connection to a DMZ, never the other way round: nothing in the outer network can open a connection inwards.

| Shape | Protects against | Needs |
|---|---|---|
| 1 | an attack on the machine that faces the internet. It is security, not availability: the one server behind is still one. | [The DMZ server](DMZ.md) |
| 2 | the loss of a server | a cluster, [replication](Replication.md), [shared storage](HA-Shared-Users-and-Storage.md), and something that sends users to a server that is up: a [load balancer](HA-Load-Balancer.md) or [ServerBeat](ServerBeat.md) |
| 3 | both | all of the above; each DMZ is linked to one server at a time, and another server stands by for it |
| 4 | the loss of a server, without a load balancer | [ServerBeat](ServerBeat.md): one server works, the others wait |

## What must be the same on every server

| | How |
|---|---|
| the users, groups, jobs, settings, shares | [replication](Replication.md) carries every change. What existed before a server joined is copied once. |
| the files | **not replicated.** All servers must reach the same storage: [Shared users and shared storage](HA-Shared-Users-and-Storage.md) |
| the logins that are open | [session replication](Session-Replication.md), so that a user who lands on another server is still logged in |
| the certificate | the same on all, or users see warnings on one of them: [Let's Encrypt in a cluster](HA-Lets-Encrypt.md) |
| the record that reports read | one folder that all servers reach: [The store on disk](Reports-Store.md#in-a-cluster) |
| the version | update one server at a time; the Cluster section does it for you |

## Who sends users to a server that is up

| Way | How it works | Good for |
|---|---|---|
| a [load balancer](HA-Load-Balancer.md) | a device or program in front spreads connections over all servers and leaves out the ones that do not answer | all servers working at once; more load than one server takes |
| [ServerBeat](ServerBeat.md) | the servers share an address; the one that holds it does the work | two servers, one working and one waiting, with nothing else in front |
| DNS | several addresses under one name | spreading only. DNS does not notice a dead server. |

## Building one

The order that works:

1. Set up the first server completely, alone.
2. Decide on the shared storage, and move the files there.
3. On the first server: **Server Admin, Cluster, Create a cluster**.
4. Install the second server, and let it **Join a cluster** with a one-time code from the first: [Joining a server](Cluster-Joining.md). Copy the users and settings over.
5. Put the load balancer in front, or set up ServerBeat.
6. Pair the DMZs: [Pairing a DMZ](DMZ-Pairing.md).
7. Stop one server and watch what users see. Do this before you need it.

## Watching it

**Server Admin, Cluster** shows every server, DMZ and job engine on one page, from any server: who is up, who is linked to whom, where the load is, and what needs a look. See [The Cluster section](Cluster.md).

Alerts tell you when a server stops answering, when replication falls behind, when the shared address changes hands: [Alerts overview](Alerts.md).

## What it does not do

- **A transfer that is under way on a server that dies is broken.** The user's program tries again, lands on another server, and with a resume goes on where it was.
- **Files are not copied between servers** by the cluster. Shared storage, or the mirroring of [VFS replication](Prefs-Replication.md#vfs-replication), is yours to arrange.
- **A cluster is not a backup.** A user deleted on one server is deleted on all, at once.
- **Two sites** far apart can be one cluster; the links are made for it. The storage is the hard part there, not the servers.

## Coming from CrushFTP 11

Version 11 tied servers together by address and a shared secret. CrushMFT 27 gives every server and DMZ a key of its own and ties them by those: see [Trust between servers](Cluster-Trust.md). Servers that replicate the old way keep working after the update and can be brought into a cluster with a click. Two things do not wait: **ServerBeat** and **DMZ links** work only between nodes that know each other's keys.
