You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an action should be performed for each instance of the given cluster,
it can be written this way:
forinstance_nameinpairs(config:instances()) doaction(instance_name)
end
If replicaset/group names matter, the instances may be filtered this
way:
-- Perform an action for all instances of the given replicaset.forinstance_name, definpairs(config:instances()) doifdef.replicaset_name==box.info.replicaset.namethenaction(instance_name)
endend
config:get(<...>, {instance = '<...>'})
The new instance option of the config:get() method allows to
retrieve a configuration value of another instance from the given
cluster.
Example:
-- Collect all the enabled roles within the cluster.localenabled_roles= {}
forinstance_nameinpairs(config:instances()) dolocalroles=config:get('roles', {instance=instance_name})
for_, roleinipairs(roles) doenabled_roles[role] =trueendend
Note: There is a difference between a missing instance option and the instance option that is equal to the given instance name. The former
returns an instance configuration taking into account instance
configuration sources (environment variables). The latter takes into
account only cluster configuration, so the environment variables are
ignored.
Related dev. issue(s): tarantool/tarantool#9680
Product: Tarantool
Since: 3.1
Root document:
SME: @Totktonada
Details
config:instances()
Lists all instances of the cluster.
Returns a table of the following format.
If an action should be performed for each instance of the given cluster,
it can be written this way:
If replicaset/group names matter, the instances may be filtered this
way:
config:get(<...>, {instance = '<...>'})
The new
instance
option of theconfig:get()
method allows toretrieve a configuration value of another instance from the given
cluster.
Example:
Note: There is a difference between a missing
instance
option and theinstance
option that is equal to the given instance name. The formerreturns an instance configuration taking into account instance
configuration sources (environment variables). The latter takes into
account only cluster configuration, so the environment variables are
ignored.
Requested by @ Totktonada in tarantool/tarantool@30a9c1c.
The text was updated successfully, but these errors were encountered: