Clustering
Running Memgraph in a clustered setup improves resilience, fault-tolerance, and uptime for any graph-powered application. By deploying multiple Memgraph instances, you can ensure continuous availability, even in the event of failures.
Memgraph supports clustering through two main features:
- Replication (available in Memgraph Community)
- High Availability (HA) (available in Memgraph Enterprise)
Before configuring a cluster, we highly recommend reading the guide on how replication works in Memgraph. Understanding replication modes and choosing the right number of instances is essential, as these decisions directly influence cluster performance and reliability. In this guide you’ll learn about the underlying implementation and theoretical concepts behind Memgraph replication, including CAP theorem, replication modes and synchronization mechanisms.
Replication and high availability currently work only in the in-memory transactional storage mode.
Replication Community
Memgraph Community provides replication out of the box. A typical setup includes:
- MAIN instance – handles both reads and writes.
- REPLICA instances – read-only copies that can scale your query throughput.
You can run as many REPLICAS as needed. However, Community Edition does not provide automatic failover, meaning that if the MAIN instance becomes unavailable, manual intervention is required to promote a REPLICA.
To build a reliable architecture using Memgraph Community, you’ll need to handle failover logic yourself, either through custom tooling or orchestration platforms.
In the replication section of the docs you’ll get step-by-step instructions for setting up a replication cluster. Ideal for users who want read scaling or multiple data copies. Note that high availability is not included, so manual failover is required.
High availability Enterprise
Memgraph Enterprise includes everything from Community edition plus built-in high availability management. An Enterprise cluster typically consists of:
- MAIN instance
- REPLICA instances
- COORDINATOR instances – powered by the Raft consensus protocol, responsible for cluster state management and automatic leader election.
The COORDINATOR nodes ensure that the cluster can automatically recover from failures, making true 24/7 uptime possible without manual failover procedures.
In the high availability section of the docs you’ll learn how to configure, manage, and monitor a full HA cluster using Memgraph Enterprise, including automatic failover and coordinator management.
Concepts & internals
If you want to understand how clustering works under the hood before or while you’re setting things up, these concept guides walk through the theory and architecture behind Memgraph clustering:
-
Replication concepts
Learn how Memgraph models replication from a distributed systems perspective: CAP theorem, roles (MAIN / REPLICA), replication modes (SYNC, ASYNC, STRICT_SYNC), durability (snapshots, WALs, deltas), and how replicas recover and stay in sync.
→ How replication works in Memgraph -
High availability architecture (Enterprise)
Deep dive into how Memgraph achieves automatic failover and 24/7 uptime using coordinator instances, the Raft consensus protocol, health checks, failover decision logic, and RPO/RTO considerations.
→ How high availability works -
Query routing in a HA cluster (Enterprise)
Learn why plainbolt://isn’t enough in a clustered setup and how Bolt+routing (neo4j://) works with coordinators to always send writes to the current MAIN and transparently route reads across the cluster.
→ Querying the cluster in high availability
These pages focus on theoretical and architectural aspects. The sections below focus on how to actually configure and operate your replication or high availability cluster.
FAQ
Frequently asked questions about clustering, replication, and high availability in Memgraph.