docs/en/08-operation/18-ha/02-replica2.md
import Enterprise from '../../assets/resources/_enterprise.mdx';
<Enterprise/>TDengine offers an arbitrator-based dual-replica solution that enables fault tolerance, provided that only one node fails at a time and failures are not continuous. Compared with three-replica deployments, dual-replica mode reduces hardware costs while ensuring a certain level of high availability.
In this architecture, leader election is handled by the high-availability mnode through arbitration, rather than being decided within the Raft group.
The dual-replica architecture requires at least three server nodes. The basic deployment and configuration steps are as follows:
Create two additional dnodes in your cluster for a total of three dnodes:
CREATE dnode <dnode_ep> port <dnode_port>;
CREATE dnode <dnode_ep> port <dnode_port>;
Create mnodes on the two dnodes for a total of three mnodes:
CREATE mnode on dnode <dnode_id>;
CREATE mnode on dnode <dnode_id>;
Create a dual-replica database:
create database <dbname> replica 2 vgroups xx buffer xx ...
If you have already created a single-replica database, you can change it into a dual-replica database:
alter database <dbname> replica 2;
| Scenario | Result |
|---|---|
| Arbitrator failure (two or more mnodes down) | Service available |
| Single vnode failure after vgroup has finished synchronization | Service available |
| Double vnode failure after vgroup has finished synchronization, but one vnode recovers | You can run the ASSIGN LEADER FORCE; statement to make service available |
| Single vnode failure before vgroup has finished synchronization | Service unavailable |
| Double vnode failure | Service unavailable |
ASSIGN LEADER FORCE;
DB error: Out of dnodesDB error: Vnodes exhausted