qua_cluster_set_failover_mode

qua_cluster_set_failover_mode#

Sets the failover mode of a two-node cluster: whether the standby instance takes the serving role over by itself when the serving instance stops renewing its lease (automatic), or only with an operator’s authorization (manual). The mode belongs to the cluster, not to one instance, so it applies to both instances at once and takes effect without a restart, as an availability group’s FAILOVER_MODE does.

Note

Automatic failover mode is not supported. Run production clusters in manual failover mode. The procedure accepts automatic. See Clustering.

Syntax#

qua_cluster_set_failover_mode
    [ @failover_mode = ] 'failover_mode' [;]

Arguments#

[ @failover_mode = ] ‘failover_mode’

automatic or manual, in any case. Required.

manual (the mode of a newly provisioned cluster): when the serving instance stops, the standby waits. An operator checks that the serving instance is really down and authorizes the takeover on the standby’s node management page.

automatic: the standby takes the role over once the serving instance’s lease has expired, or at its next attempt when the serving instance released it at a clean shutdown (see Remarks). At most one automatic takeover of a failed instance happens within the anti-flapping period, 6 hours by default; a second failure within that period needs an operator, as in a Windows Server Failover Cluster. Taking over after a clean shutdown is not a takeover of a failed instance and does not start the period.

Result set#

None.

Remarks#

Run the procedure on the instance that serves clients; the standby has no client port. The instance writes the mode into the cluster’s lease in the metabase and writes a line starting with Cluster: into its log that names the mode and the account that changed it, followed by the login it matched when that is a group login. The mode shows on the Cluster page of the Admin Portal and in the instance’s health details.

The procedure is refused when the instance does not run in cluster mode, when it does not serve - it is starting, shutting down or changing its role - and when the change of the role takes longer than a minute. Nothing is changed then; run the procedure again. When the metabase does not confirm the change in time, the procedure reports that the outcome is unknown: the change may still take effect, so check the mode on the Cluster page and run the procedure again if needed. Setting the mode the cluster already has succeeds and changes nothing.

A clean shutdown of the serving instance never fails over in manual mode: the instance releases its lease, and the same instance takes the role again when it restarts. In automatic mode the standby takes the released lease, unless an anti-flapping period started by an earlier failure still runs. To move the role on purpose, in either mode, use qua_cluster_failover.

Permissions#

Requires the CONTROL SERVER permission.

Example#

Lets the standby take the role over by itself.

EXEC qua_cluster_set_failover_mode @failover_mode = N'automatic';

Switches automatic failover off again, for example before maintenance of the network between the instances and the metabase.

EXEC qua_cluster_set_failover_mode N'manual';

See Also#