Perform Hard Failover
Hard failover allows a node to be removed from a cluster reactively, because the node has become unresponsive or unstable.
Hard failover drops a node from a cluster reactively, because the node has become unresponsive or unstable. It is manually or automatically initiated, and occurs after the point at which active vBuckets have been lost.
The automatic initiation of hard failover is known as automatic failover, and is configured by means of the Node Availability panel of the General settings screen of Couchbase Web Console, or by means of equivalent CLI and REST API commands. The current page explains how to initiate hard failover manually.
A complete conceptual description of failover and its variants (including hard) is provided in Failover.
A two-node cluster already exists; as at the conclusion of Join a Cluster and Rebalance.
The cluster has the Full Administrator username of
Administrator, and password of
Proceed as follows:
Access the Couchbase Web Console Servers screen, on node
10.142.181.101, by clicking on the Servers tab in the left-hand navigation bar. The display is as follows:
To see further details of the node to be failed over, which in this example will be
188.8.131.52, click on the row for the node. The row expands vertically, as follows:
To initiate failover, click on the Failover button, at the lower right of the row for
The Confirm Failover Dialog now appears:
Two radio buttons are provided, to allow selection of either Graceful or Hard failover. Graceful is selected by default.
Select hard failover by selecting the Hard radio button:
Note the warning message that appears when hard failover is selected: in particular, this points out that hard failover may interrupt ongoing writes and replications, and that therefore it may be better to Remove a Node and Rebalance, than use hard failover on a still-available Data Service node.
To continue with hard failover, confirm your choice by clicking on the Failover Node button.
Hard failover now occurs. On conclusion, the Servers screen appears as follows:
This indicates that hard failover has successfully completed, but a rebalance is required to complete the reduction of the two-node cluster to one node.
Click the Rebalance button, at the upper right, to initiate rebalance. When the process is complete, the Server screen appears as follows:
10.142.181.102has successfully been removed.
Note that if rebalance fails, notifications are duly provided. These are described in Rebalance Failure Notification. See also the information provided on Automated Rebalance-Failure Handling, and the procedure for its set-up, described in Rebalance Settings.
Hard failover of one or more nodes can be managed by means of the FAILOVER tab, toward the upper right of the Servers screen:
As the Servers screen here shows, this example features a cluster of three nodes. Click on the FAILOVER tab to perform hard failover on one or more of the three nodes:
This brings up the Failover Multiple Nodes dialog:
The dialog provides the following Data Loss Warning: For hard failover of multiple nodes, each Couchbase bucket must have at least as many replicas as the total number of nodes failed over or you WILL lose data. Since hard failover removes nodes immediately it may also result in failure of in-flight operations.
Select one or more nodes from the checkboxes, then click on the Failover Nodes button, to start hard failover. When failover has complete, a rebalance will, as usual, be required.
To perform hard failover on a node, use the
failover command with the
--force flag, as follows:
couchbase-cli failover -c 10.142.181.102:8091 \ --username Administrator \ --password password \ --server-failover 10.142.181.102:8091 --force
--force flag specifies that failover be hard.
When the progress completes successfully, the following output is displayed:
SUCCESS: Server failed over
The cluster can now be rebalanced with the following command, to remove the failed-over node:
couchbase-cli rebalance -c 10.142.181.101:8091 \ --username Administrator \ --password password --server-remove 10.142.181.102:8091
Progress is displayed as console output. If successful, the operation gives the following output:
SUCCESS: Rebalance complete
To perform hard failover on a node with the REST API, use the
/controller/failover URI, specifying the node to be failed over, as follows:
curl -v -X POST -u Administrator:password \ http://10.142.181.101:8091/controller/failOver \ -d 'otpNodefirstname.lastname@example.org'
Subsequently, the cluster can be rebalanced, and the failed-over node removed, with the
curl -u Administrator:password -v -X POST \ http://10.142.181.101:8091/controller/rebalance \ -d 'ejectedNodes=ns_1%4010.142.181.102' \ -d 'knownNodes=ns_1%4010.142.181.101%2Cns_1%4010.142.181.102'
A node that has been failed over can be recovered and reintegrated into the cluster. See Recover a Node.