# Module cartridge.lua-api.failover

Administration functions (failover related).

## Functions

### get_params ()

Get failover configuration.

(Added in v2.0.2-2)

Returns:

(FailoverParams)

### set_params (opts)

Configure automatic failover.

(Added in v2.0.2-2)

Parameters:

- opts:

  - mode: (optional string)

  - state_provider: (optional string)

  - failover_timeout: (optional number) (added in v2.3.0-52)

  - tarantool_params: (optional table)

  - etcd2_params: (optional table) (added in v2.1.2-26)

  - fencing_enabled: (optional boolean) (added in v2.3.0-57)

  - fencing_timeout: (optional number) (added in v2.3.0-57)

  - fencing_pause: (optional number) (added in v2.3.0-57)

Returns:

(boolean) true if config applied successfully

Or

(nil)

(table) Error description

### get_failover_enabled ()

Get current failover state.

(Deprecated since v2.0.2-2)

### set_failover_enabled (enabled)

Enable or disable automatic failover.

(Deprecated since v2.0.2-2)

Parameters:

- enabled: (boolean)

Returns:

(boolean) New failover state

Or

(nil)

(table) Error description

### promote (replicaset_uuid[, opts])

Promote leaders in replicasets.

Parameters:

- replicaset_uuid: (table) ] = leader_uuid }

- opts:

  - force_inconsistency: (optional boolean) (default: false)

Returns:

(boolean) true On success

Or

(nil)

(table) Error description

## Tables

### FailoverParams

Failover parameters.

(Added in v2.0.2-2)

Fields:

- mode: (string) Supported modes are “disabled”, “eventual” and “stateful”

- state_provider: (optional string) Supported state providers are “tarantool” and “etcd2”.

- failover_timeout: (number) (added in v2.3.0-52)Timeout (in seconds), used by membership tomark `suspect` members as `dead` (default: 20)

- tarantool_params: (added in v2.0.2-2)

  - uri: (string)

  - password: (string)

- etcd2_params: (added in v2.1.2-26)

  - prefix: (string) Prefix used for etcd keys: <prefix>/lock and`<prefix>/leaders`

  - lock_delay: (optional number) Timeout (in seconds), determines lock’s time-to-live (default: 10)

  - endpoints: (optional table) URIs that are used to discover and to access etcd cluster instances.(default: `{'http://localhost:2379', 'http://localhost:4001'}` )

  - username: (optional string) (default: “”)

  - password: (optional string) (default: “”)

- fencing_enabled: (boolean) (added in v2.3.0-57)Abandon leadership when both the state provider quorum and atleast one replica are lost (suitable in stateful mode only,default: false)

- fencing_timeout: (number) (added in v2.3.0-57)Time (in seconds) to actuate fencing after the check fails(default: 10)

- fencing_pause: (number) (added in v2.3.0-57)The period (in seconds) of performing the check(default: 2)