Doc / Module cartridge.admin

Module cartridge.admin

Module cartridge.admin

Administration functions.

Functions

get_servers ([uuid])

Get servers list. Optionally filter out the server with the given uuid.

Parameters:

Returns:

({ServerInfo,…})

Or

(nil)

(table) Error description

get_replicasets ([uuid])

Get replicasets list. Optionally filter out the replicaset with given uuid.

Parameters:

Returns:

({ReplicasetInfo,…})

Or

(nil)

(table) Error description

probe_server (uri)

Discover an instance.

Parameters:

enable_servers (uuids)

Enable nodes after they were disabled.

Parameters:

Returns:

({ServerInfo,…})

Or

(nil)

(table) Error description

disable_servers (uuids)

Temporarily diable nodes.

Parameters:

Returns:

({ServerInfo,…})

Or

(nil)

(table) Error description

get_failover_enabled ()

Get current failover state.

set_failover_enabled (enabled)

Enable or disable automatic failover.

Parameters:

  • enabled: (boolean)

Returns:

(boolean) New failover state

Or

(nil)

(table) Error description

bootstrap ()

Call vshard.router.bootstrap() . This function distributes all buckets across the replica sets.

Returns:

(boolean) true

Or

(nil)

(table) Error description

Tables

ServerInfo

Instance general information.

Fields:

  • alias: (string) Human-readable instance name.

  • uri: (string)

  • uuid: (string)

  • disabled: (boolean)

  • status: (string) Instance health.

  • message: (string) Auxilary health status.

  • replicaset: (ReplicasetInfo) Circular reference to a replicaset.

  • priority: (number) Leadership priority for automatic failover.

  • clock_delta: (number) Difference between remote clock and the current one (inseconds), obtained from the membership module (SWIM protocol).Positive values mean remote clock are ahead of local, and viceversa.

ReplicasetInfo

Replicaset general information.

Fields:

  • uuid: (string) The replicaset UUID.

  • roles: ({string,…}) Roles enabled on the replicaset.

  • status: (string) Replicaset health.

  • master: (ServerInfo) Replicaset leader according to configuration.

  • active_master: (ServerInfo) Active leader.

  • weight: (number) Vshard replicaset weight.Matters only if vshard-storage role is enabled.

  • vshard_group: (string) Name of vshard group the replicaset belongs to.

  • all_rw: (boolean) A flag indicating that all servers in the replicaset should be read-write.

  • alias: (string) Human-readable replicaset name.

  • servers: ({ServerInfo,…}) Circular reference to all instances in the replicaset.

Local Functions

get_stat (uri)

Retrieve box.slab.info of a remote server.

Parameters:

Returns:

(table)

Or

(nil)

(table) Error description

get_info (uri)

Retrieve box.cfg and box.info of a remote server.

Parameters:

Returns:

(table)

Or

(nil)

(table) Error description

get_self ()

Get alias, uri and uuid of current instance.

Returns:

(table)

Editing topology

edit_topology (args)

Edit cluster topology. This function can be used for:

  • bootstrapping cluster from scratch

  • joining a server to an existing replicaset

  • creating new replicaset with one or more servers

  • editing uri/labels of servers

  • disabling and expelling servers

(Added in v1.0.0-17)

Parameters:

EditReplicasetParams

Replicatets modifications.

Fields:

JoinServerParams

Parameters required for joining a new server.

Fields:

EditServerParams

Servers modifications.

Fields:

  • uri: (optional string)

  • uuid: (string)

  • labels: (optional table)

  • disabled: (optional boolean)

  • expelled: (optional boolean) Expelling an instance is permanent and can’t be undone.It’s suitable for situations when the hardware is destroyed,snapshots are lost and there is no hope to bring it back to life.

Deprecated functions

join_server (args)

Join an instance to the cluster (deprecated).

(Deprecated since v1.0.0-17 in favor of cartridge.admin_edit_topology)

Parameters:

Returns:

(boolean) true

Or

(nil)

(table) Error description

edit_server (args)

Edit an instance (deprecated).

(Deprecated since v1.0.0-17 in favor of cartridge.admin_edit_topology)

Parameters:

Returns:

(boolean) true

Or

(nil)

(table) Error description

expel_server (uuid)

Expel an instance (deprecated). Forever.

(Deprecated since v1.0.0-17 in favor of cartridge.admin_edit_topology)

Parameters:

Returns:

(boolean) true

Or

(nil)

(table) Error description

edit_replicaset (args)

Edit replicaset parameters (deprecated).

(Deprecated since v1.0.0-17 in favor of cartridge.admin_edit_topology)

Parameters:

Returns:

(boolean) true

Or

(nil)

(table) Error description