# 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.


In Typesense Cloud, we manage High Availability for you, when you flip the setting ON when launching the cluster. So the rest of this section only applies if you're self-hosting Typesense.

# 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: 7/13/2021, 12:25:08 PM