Enabling and Disabling Auto-Failover
- reference
Send a POST message to the /settings/autoFailover endpoint to change auto-failover settings.
Description
You can use the POST /settings/autoFailover HTTP method and URI to enable, turn off, and change auto-failover settings.
Auto-failover settings are global, applying to all nodes in the cluster.
Syntax
curl -X POST http://<ip-address-or-hostname>:8091/settings/autoFailover
-u <username>:<password>
-d 'enabled=[true|false]'
-d 'timeout=<number-of-seconds>'
-d 'maxCount=<number-of-nodes>'
-d 'failoverOnDataDiskIssues[enabled]=[true|false]'
-d 'failoverOnDataDiskIssues[timePeriod]=<number-of-seconds>'
-d 'canAbortRebalance=[true|false]'
-d 'failoverPreserveDurabilityMajority=[true|false]'
-d 'allowFailoverEphemeralNoReplicas=[true|false]'
-d 'failoverOnDataDiskNonResponsiveness[enabled]=[true|false]'
-d 'failoverOnDataDiskNonResponsiveness[timePeriod]=<number-of-seconds>'
The parameters are as follows:
-
enabled: Enables or disables automatic failover. Default setting istrue. This parameter is required. If you setenabledtotrue, you must also supply a value for thetimeoutparameter. Settingenabledtofalseautomatically setsfailoverOnDataDiskIssues[enabled]andfailoverOnDataDiskNonResponsivenesstofalse.When you set enabledtofalse, Couchbase Server ignores any values you supply for additional parameters includingfailoverOnDataDiskIssues[enabled]andcanAbortRebalance. -
timeout: Sets the number of seconds Couchbase Server waits before performing an auto-failover on an unresponsive node. Default setting is 120. Thetimeoutparameter can only be specified whenenabledis set totrue. This parameter and its values are ignored if the value for theenabledparameter isfalse.You can set the value of
timeoutto1second. A low setting, such as anything less than 5 seconds, increases the sensitivity of failure detection. This low setting can cause false positives which result in Couchbase Server triggering auto-failovers unnecessarily. It also increases CPU usage.If you want to use a low setting, test a representative workload before setting the value of
timeoutto1in a production environment. Make sure to measure CPU usage. Monitor the cluster for auto-failovers caused by false positives.
-
maxCount: Sets the maximum number of nodes Couchbase Server can auto-failover at a time. Once this number of nodes has been auto-failed over, Couchbase Server does not auto-failover more nodes until you reset the count or resolve the auto-failovers with a rebalance to recover or remove the failed-over nodes. The maximum value can be up to the number of configured nodes. The default value is 1. This parameter is optional, and is only supported by Couchbase Server Enterprise Edition. This parameter and its values are ignored if the value for theenabledparameter isfalse. -
failoverOnDataDiskIssues[enabled]: Sets whether Couchbase Server performs auto-failovers on nodes where the data disk read or write attempts have resulted in errors continuously throughout at least 60% of the time-period set infailoverOnDataDiskIssues[timePeriod]. The default value forfailoverOnDataDiskIssues[enabled]isfalse. When you set this value totrue, you must also supply a value forfailoverOnDataDiskIssues[timePeriod]. -
failoverOnDataDiskIssues[timePeriod]: Sets the period of time in seconds that a node’s data disk can return errors before Couchbase Server performs an auto-failover. The valid range for this value is between 5 and 3600 seconds. If you setfailoverOnDataDiskIssues[enabled]is totrue, you must also supply a value for this parameter.If
failoverOnDataDiskIssues[enabled]is not specified, butfailoverOnDataDiskIssues[timePeriod]is specified, the following error message is generated:The value of "failoverOnDataDiskIssues[enabled]" must be true or false.If you supply a value for this parameter while
failoverOnDataDiskIssues[enabled]isfalse, Couchbase Server ignores the setting. -
canAbortRebalance. Sets whether Couchbase Server can perform an auto-failover while a rebalance is taking place. This parameter is optional, and is only available in Couchbase Enterprise Edition. The value can be eithertrue(the default) orfalse. Couchbase Server ignores this setting if you setenabledtofalse.
-
failoverPreserveDurabilityMajority. Sets whether Couchbase Server refuses to auto-failover a node if doing so could result in the loss of durably written data. Can betrueorfalse(the default). For information, see Preserving Durable Writes. -
failoverOnDataDiskNonResponsiveness[enabled]: Sets whether Couchbase Server performs an auto-failover on a node when the data disk has not completed an operation in the period set byfailoverOnDataDiskNonResponsiveness[timePeriod]. The default value isfalse. When you set this value totrue, you must also supply a value forfailoverOnDataDiskNonResponsiveness[timePeriod]. -
failoverOnDataDiskNonResponsiveness[timePeriod]: Sets the period of time in seconds that a node’s data disk has to be unresponsive before Couchbase Server performs an auto-failover. The valid range for this value is between 5 and 3600 seconds. If you setfailoverOnDataDiskNonResponsiveness[enabled]totrue, you must also supply a value for this parameter. -
allowFailoverEphemeralNoReplicas: Sets whether Couchbase Server can auto-failover a node that contains vBuckets for an unreplicated ephemeral bucket. The default value isfalse, which means Couchbase Server does not perform an auto-failover on a node that contains vBuckets for an unreplicated ephemeral bucket . When you set this value totrue, Couchbase Server can perform an auto-failover on the node even through it results in the loss of the data from the ephemeral bucket’s vBuckets on the node. This setting is only available in Couchbase Server Enterprise Edition.
Required Permissions
You must have one of the following roles to make changes to the auto-failover settings:
Responses
- 200 OK
-
The call succeeded, and the auto-failover settings were changed.
- 400 Bad Request
-
The call failed because the request was malformed or lacked required settings.
- 401 Unauthorized
-
The call failed because the user did not have the proper permissions to change the auto-failover settings.
Example
The following example enables auto-failover for the cluster, with a timeout of 72 seconds, and a maxCount of 2.
It also enabled auto-failover on disk issues, and establishes the corresponding time period as 89 seconds.
curl -X POST -u Administrator:password \
http://10.144.231.101:8091/settings/autoFailover \
-d 'enabled=true' \
-d 'timeout=72' \
-d 'maxCount=2' \
-d 'failoverOnDataDiskIssues[enabled]=true' \
-d 'failoverOnDataDiskIssues[timePeriod]=89'
This example disables auto-failover for the cluster:
curl -X POST -u Administrator:password \
http://localhost:8091/settings/autoFailover \
-d 'enabled=false'
See Also
-
For an overview of auto-failover, see Automatic Failover.
-
For an overview of durability, see Durability.
-
To retrieve the current auto-failover setting using the REST API, see Retrieving Auto-Failover Settings.
-
To manage auto-failover using the command line, see setting-autofailover command.
-
To learn how to manage auto-failover with Couchbase Server Web Console, see Node Availability.
-
To learn how to change a bucket’s durability settings, see Creating and Editing Buckets.