Automatic failover handling in RethinkDB
RethinkDB provides automatic failover handling in a multi-server configuration where multiple replicas of a table are present. In case of node failure due to any reason, RethinkDB finds out the other node to divert the request and maintain the availability. However, there are some requirements that must be met before considering automatic failover handling:
- The cluster must have three or more nodes (RethinkDB servers)
- The table must be set to have three or more replicas set with the voting option
- During failover, the majority of replicas (greater than half of all replicas) for the table must be online
Every table, by default, has a primary replica created by RethinkDB. You can always change that using the reconfigure()
command. In case of failure of the primary replica of the table, as long as more than half of the replicas with voting option are available, one of them will be internally selected as the primary replica. There will be a slight offline scenario while the selection is going on in RethinkDB, but that will be very minor and no data will be lost.
As soon as the primary replica comes online, RethinkDB automatically syncs it with the latest documents and switches control of the primary replica to it automatically.