# CrushBalance

CrushBalance 27 is a load balancer for CrushMFT. It sits in front of two or more CrushMFT servers, takes every client connection (HTTPS, FTP, FTPS, SFTP or any other TCP service), and passes it to a server that is up and has room. It is part of every CrushMFT Enterprise license.

![The CrushBalance dashboard](Dashboard/dashboard.png)

## What it does

- **Balances every CrushMFT protocol.** The WebInterface over HTTPS, FTP and FTPS with their passive port ranges, SFTP, and any other TCP port.
- **Keeps a user on one server.** For the WebInterface it follows CrushMFT's `CrushAuth` session cookie, so a browser that opens several connections still reaches the server that holds its session. Other protocols stay on one server per client address.
- **Shows CrushMFT the real client address.** With the PROXY protocol (v1 or v2) CrushMFT's IP restrictions, bans and logs see the client, not the balancer.
- **Checks the servers.** A TCP connect, an HTTP request, or a CrushMFT login that also reads the server's load. A server that is down gets no new connections.
- **Three balancing methods:** fewest connections, round robin, or the CrushMFT server with the lowest load.
- **TLS where you want it.** Pass TLS through untouched, end it at the balancer, or end it and encrypt again towards CrushMFT.
- **Access rules that work like CrushMFT's IP restrictions,** for everything, per listener and per server.
- **A browser admin page** with live connections, charts, a world map, logs, and every setting. Changes apply at once, and open sessions are never cut by a change.
- **One jar, nothing else.** Java 25 or newer, one `prefs.XML`, a Linux daemon or a Windows service.
- **For monitoring:** a `/healthz` address and Prometheus `/metrics`.

## How it works with CrushMFT

```
                         ┌─────────────────┐      ┌──────────────┐
 clients ──────────────► │  CrushBalance   │ ───► │  CrushMFT 1  │
 HTTPS 443, FTP 21,      │  listeners      │ ───► │  CrushMFT 2  │
 passive ports, SFTP     │  (one per port) │ ───► │  CrushMFT 3  │
                         └─────────────────┘      └──────────────┘
                           admin page :8090        "endpoints"
```

- A **listener** is a port (or a range of ports) that CrushBalance accepts clients on.
- An **endpoint** is one CrushMFT server behind a listener.
- For each new connection CrushBalance picks an endpoint and relays the data both ways. The [Concepts](Concepts.md) page explains the listener modes, stickiness and what happens when you change a setting.

What it does not do: it does not end FTP or SFTP sessions itself (they pass through unchanged), it has no HTTP/2 or HTTP/3, and it does not use client certificates.

## What you need

| | |
|---|---|
| Java | 25 or newer on the balancer machine |
| License | a **CrushFTP 11 or newer Enterprise** registration: the same name, email and code as in CrushMFT. Without it no listener starts. |
| CrushMFT servers | CrushFTP 11 or newer. Two or more for a farm; one works too. |
| Operating system | Linux (daemon) or Windows (service); anything else that runs Java 25 for a test |
| Ports | your listener ports, plus the admin page on HTTPS port 8090 |

## Download

<!-- DOWNLOAD-LINK: CrushBalance 27 jar and crushbalance_init.sh -->
The download link will be added here when the build is published (`https://www.crushftp.com/early27/…`). You need `CrushBalance.jar` and, on Linux, `crushbalance_init.sh`.

## Where to start

| If you want to | Read |
|---|---|
| Try it in ten minutes | [Quick start](Quick-Start.md) |
| Install it properly | [Before you start](Before-You-Start.md), then [Install on Linux](Install-Linux.md) or [Install on Windows](Install-Windows.md) |
| Put your CrushMFT web port behind it | [Template: HTTPS for CrushMFT WebInterface](Template-HTTPS-WebInterface.md) |
| Balance FTP | [Template: FTP with passive ranges](Template-FTP-Passive-Ranges.md) |
| Balance SFTP | [Template: TCP or TLS](Template-TCP-or-TLS.md) |
| Find your way around the admin page | [Admin UI](Admin-UI.md) |
| Replace CrushBalance 11 | [What's new](Whats-New.md) and [Upgrading from CrushBalance 11](Upgrading.md) |
| Lock it down | [Hardening](Hardening.md) |
| Look up a setting | [Key reference](Key-Reference.md) |
