Failing over nodes

Nodes are failed over either by a graceful failover or hard failover operation. Graceful failover is the default.

Description

Nodes are failed over with one of the following methods:
  • Graceful failover
  • Hard failover

Graceful failover safely fails over nodes from clusters by allowing all in-flight operations to complete before implementing the failover operation. Graceful failover is the default behavior for the couchbase-cli failover operation.

Hard failover immediately fails over nodes from clusters. To perform a hard failover, the --force option is used. Hard failover is typically used when the node is in a bad state. Auto-failover is a hard failover.

Note: Be sure to update any scripts that implement failover.

Syntax

couchbase-cli failover
    --cluster=HOST:PORT
    --server-failover=HOST:PORT
    --user=ADMIN 
    --password=PASSWORD 

Setting failover, readd, recovery, and rebalance operations

The following example shows a failover, readd, recovery and rebalance sequence operations, where as, a node in a cluster is gracefully failed over, the node is re-added to the cluster, a delta recovery is implemented for the node, and rebalance is performed on the cluster:


couchbase-cli failover -c 192.168.0.1:8091 \\	
    --server-failover=192.168.0.2 \\	
    -u Administrator -p password	
				
couchbase-cli server-readd -c 192.168.0.1:8091 \\	
    --server-add=192.168.0.2 \\	
    -u Administrator -p password	
			
couchbase-cli recovery -c 192.168.0.1:8091 \\	
    --server-recovery=192.168.0.2 \\	
    --recovery-type=delta \\	
    -u Administrator -p password	
				
couchbase-cli rebalance -c 192.168.0.1:8091 \\	
    -u Administrator -p password          
      

Failing over a node immediately

The following example shows a node failing over immediately, that is, a hard failover is implemented rather than a graceful failover.


couchbase-cli failover -c 192.168.0.1:8091 \\	
    --server-failover=192.168.0.2 \\	
    --force  \\
    -u Administrator -p password