# High Availability

You can run a cluster of Typesense nodes for high availability. Typesense uses the Raft consensus algorithm to manage the cluster and recover from node failures.


Since Raft requires a quorum of nodes for consensus, you need to run a minimum of 3 nodes to tolerate a 1-node failure. Running a 5-node cluster will tolerate failures of up to 2 nodes, but at the expense of higher write latencies.

Therefore, we recommend running a 3-node Typesense cluster.

# Configuring a Typesense cluster

To start a Typesense node as part of a cluster, use the --nodes argument to point to a file that contains a comma separated string of all nodes in the cluster.

Each node definition should be in the following format:


Example content of a --nodes file for a 3-node cluster:

In the example above, the peering port (i.e. the port used for cluster operations) is 8107 and the API port (the actual port to which clients connect to) is 8108.

# Client configuration

Typesense clients allow you to specify one or more nodes during client initialization.

Client libraries will load balance reads and writes across all nodes and will automatically strive to recover from transient failures through built-in retries.

Here's a sample 3-node client configuration:

Last Updated: 6/15/2021, 4:16:29 AM