Module luatest.cluster | Tarantool
Документация на русском языке
поддерживается сообществом

Module luatest.cluster

Tarantool 3.0+ cluster management utils.

The helper is used to automatically collect a set of instances from the provided configuration and automatically set up servers per each configured instance.

local cluster = Cluster:new(config)
cluster:start()
cluster['instance-001']:exec(<...>)
cluster:each(function(server)
    server:exec(<...>)
end)

After setting up a cluster object the following methods could
be used to interact with it:

* :start() Startup the cluster.
* :start_instance() Startup a specific instance.
* :stop() Stop the cluster.
* :each() Execute a function on each instance.
* :size() get an amount of instances
* :drop() Drop the cluster.
* :sync() Sync the configuration and collect a new set of
  instances
* :reload() Reload the configuration.

The module can also be used for testing failure startup
cases:

Cluster:startup_error(config, error_message)

Drop the cluster’s servers.

Execute for server in the cluster.

Parameters:

  • f: (func) Function to execute with a server as the first param.

Create a new Tarantool cluster.

Parameters:

  • config: (tab) Cluster configuration.
  • server_opts: (tab) Extra options passed to server:new(). (optional)
  • opts: Cluster options.
    • dir: (string) Specific directory for the cluster. (optional)

Returns:

table

Reload configuration on all the instances.

Parameters:

  • config: (tab) New config. (optional)

Get cluster size.

Returns:

number.

Start all the instances.

Parameters:

  • opts: Cluster startup options.
    • wait_until_ready: (bool) Wait until servers are ready(default: false). (optional)

Start the given instance.

Parameters:

  • instance_name: (string) Instance name.

Ensure cluster startup error Starts a all instance of a cluster from the given config and ensure that all the instances fails to start and reports the given error message.

Parameters:

  • config: (tab) Cluster configuration.
  • exp_err: (string) Expected error message.

Stop the whole cluster.

Sync the cluster object with the new config.

It performs the following actions.

  • Write the new config into the config file.
  • Update the internal list of instances.

Parameters:

  • config: (tab) New config.
Нашли ответ на свой вопрос?
Обратная связь