Setting up replicasets
The cartridge replicasets
command is used to configure replica sets on local start.
cartridge replicasets [subcommand] [flags] [args]
The following flags work with any replicasets
subcommand:
--name |
Application name. |
--run-dir |
The directory where PID and socket files are stored.
Defaults to ./tmp/run or the run-dir value in .cartridge.yml . |
--cfg |
Instances’ configuration file.
Defaults to ./instances.yml or the cfg value in .cartridge.yml . |
Replicasets are configured using the Cartridge Lua API.
All instances in the topology are described in a single file,
instances.yml
(see the --cfg
flag).
The instances receive their configuration through instance console sockets
that can be found in the run directory.
First, all the running instances mentioned in instances.yml
are organized into a
membership
network.
In this way, Cartridge checks if there are any instances that have already joined the cluster.
One of these instances is then used to perform cluster operations.
setup
cartridge replicasets setup [flags]
Setup replica sets using a file.
Flags:
--file
File with replica set configuration.
Defaults to replicasets.yml
.
--bootstrap-vshard
Bootstrap vshard upon setup.
Example configuration:
router:
instances:
- router
roles:
- vshard-router
- app.roles.custom
s-1:
instances:
- s1-master
- s1-replica
roles:
- vshard-storage
weight: 11
all_rw: false
vshard_group: default
All the instances should be described in instances.yml
(or another file passed via
--cfg
).
save
cartridge replicasets save [flags]
Saves the current replica set configuration to a file.
Flags:
--file
The file to save the configuration to.
Defaults to replicasets.yml
.
list
cartridge replicasets list [flags]
Lists the current cluster topology.
join
cartridge replicasets join [INSTANCE_NAME...] [flags]
Joins an instance to a cluster.
Flags:
--replicaset
Name of the replica set
If a replica set with the specified alias isn’t found in cluster, it is created.
Otherwise, instances are joined to an existing replica set.
To join an instance to a replica set, Cartridge requires the instance to have its
advertise_uri
specified in instances.yml
.
list-roles
cartridge replicasets list-roles [flags]
List the available roles.
list-vshard-groups
cartridge replicasets list-vshard-groups [flags]
List the available vshard groups.
add-roles
cartridge replicasets add-roles [ROLE_NAME...] [flags]
Add roles to the replica set.
Flags:
--replicaset
Name of the replica set
--vshard-group
Vshard group for vshard-storage
replica sets
remove-roles
cartridge replicasets remove-roles [ROLE_NAME...] [flags]
Remove roles from the replica set.
Flags:
--replicaset
Name of the replica set
set-weight
cartridge replicasets set-weight WEIGHT [flags]
Specify replica set weight.
Flags:
--replicaset
Name of the replica set
set-failover-priority
cartridge replicasets set-failover-priority INSTANCE_NAME... [flags]
Configure replica set failover priority.
Flags:
--replicaset
Name of the replica set
cartridge replicasets setup [flags]
Setup replica sets using a file.
Flags:
--file |
File with replica set configuration.
Defaults to replicasets.yml . |
--bootstrap-vshard |
Bootstrap vshard upon setup. |
Example configuration:
router:
instances:
- router
roles:
- vshard-router
- app.roles.custom
s-1:
instances:
- s1-master
- s1-replica
roles:
- vshard-storage
weight: 11
all_rw: false
vshard_group: default
All the instances should be described in instances.yml
(or another file passed via
--cfg
).
save
cartridge replicasets save [flags]
Saves the current replica set configuration to a file.
Flags:
--file
The file to save the configuration to.
Defaults to replicasets.yml
.
list
cartridge replicasets list [flags]
Lists the current cluster topology.
join
cartridge replicasets join [INSTANCE_NAME...] [flags]
Joins an instance to a cluster.
Flags:
--replicaset
Name of the replica set
If a replica set with the specified alias isn’t found in cluster, it is created.
Otherwise, instances are joined to an existing replica set.
To join an instance to a replica set, Cartridge requires the instance to have its
advertise_uri
specified in instances.yml
.
list-roles
cartridge replicasets list-roles [flags]
List the available roles.
list-vshard-groups
cartridge replicasets list-vshard-groups [flags]
List the available vshard groups.
add-roles
cartridge replicasets add-roles [ROLE_NAME...] [flags]
Add roles to the replica set.
Flags:
--replicaset
Name of the replica set
--vshard-group
Vshard group for vshard-storage
replica sets
remove-roles
cartridge replicasets remove-roles [ROLE_NAME...] [flags]
Remove roles from the replica set.
Flags:
--replicaset
Name of the replica set
set-weight
cartridge replicasets set-weight WEIGHT [flags]
Specify replica set weight.
Flags:
--replicaset
Name of the replica set
set-failover-priority
cartridge replicasets set-failover-priority INSTANCE_NAME... [flags]
Configure replica set failover priority.
Flags:
--replicaset
Name of the replica set
cartridge replicasets save [flags]
Saves the current replica set configuration to a file.
Flags:
--file |
The file to save the configuration to.
Defaults to replicasets.yml . |
list
cartridge replicasets list [flags]
Lists the current cluster topology.
join
cartridge replicasets join [INSTANCE_NAME...] [flags]
Joins an instance to a cluster.
Flags:
--replicaset
Name of the replica set
If a replica set with the specified alias isn’t found in cluster, it is created.
Otherwise, instances are joined to an existing replica set.
To join an instance to a replica set, Cartridge requires the instance to have its
advertise_uri
specified in instances.yml
.
list-roles
cartridge replicasets list-roles [flags]
List the available roles.
list-vshard-groups
cartridge replicasets list-vshard-groups [flags]
List the available vshard groups.
add-roles
cartridge replicasets add-roles [ROLE_NAME...] [flags]
Add roles to the replica set.
Flags:
--replicaset
Name of the replica set
--vshard-group
Vshard group for vshard-storage
replica sets
remove-roles
cartridge replicasets remove-roles [ROLE_NAME...] [flags]
Remove roles from the replica set.
Flags:
--replicaset
Name of the replica set
set-weight
cartridge replicasets set-weight WEIGHT [flags]
Specify replica set weight.
Flags:
--replicaset
Name of the replica set
set-failover-priority
cartridge replicasets set-failover-priority INSTANCE_NAME... [flags]
Configure replica set failover priority.
Flags:
--replicaset
Name of the replica set
cartridge replicasets list [flags]
Lists the current cluster topology.
join
cartridge replicasets join [INSTANCE_NAME...] [flags]
Joins an instance to a cluster.
Flags:
--replicaset
Name of the replica set
If a replica set with the specified alias isn’t found in cluster, it is created.
Otherwise, instances are joined to an existing replica set.
To join an instance to a replica set, Cartridge requires the instance to have its
advertise_uri
specified in instances.yml
.
list-roles
cartridge replicasets list-roles [flags]
List the available roles.
list-vshard-groups
cartridge replicasets list-vshard-groups [flags]
List the available vshard groups.
add-roles
cartridge replicasets add-roles [ROLE_NAME...] [flags]
Add roles to the replica set.
Flags:
--replicaset
Name of the replica set
--vshard-group
Vshard group for vshard-storage
replica sets
remove-roles
cartridge replicasets remove-roles [ROLE_NAME...] [flags]
Remove roles from the replica set.
Flags:
--replicaset
Name of the replica set
set-weight
cartridge replicasets set-weight WEIGHT [flags]
Specify replica set weight.
Flags:
--replicaset
Name of the replica set
set-failover-priority
cartridge replicasets set-failover-priority INSTANCE_NAME... [flags]
Configure replica set failover priority.
Flags:
--replicaset
Name of the replica set
cartridge replicasets join [INSTANCE_NAME...] [flags]
Joins an instance to a cluster.
Flags:
--replicaset |
Name of the replica set |
If a replica set with the specified alias isn’t found in cluster, it is created. Otherwise, instances are joined to an existing replica set.
To join an instance to a replica set, Cartridge requires the instance to have its
advertise_uri
specified in instances.yml
.
list-roles
cartridge replicasets list-roles [flags]
List the available roles.
list-vshard-groups
cartridge replicasets list-vshard-groups [flags]
List the available vshard groups.
add-roles
cartridge replicasets add-roles [ROLE_NAME...] [flags]
Add roles to the replica set.
Flags:
--replicaset
Name of the replica set
--vshard-group
Vshard group for vshard-storage
replica sets
remove-roles
cartridge replicasets remove-roles [ROLE_NAME...] [flags]
Remove roles from the replica set.
Flags:
--replicaset
Name of the replica set
set-weight
cartridge replicasets set-weight WEIGHT [flags]
Specify replica set weight.
Flags:
--replicaset
Name of the replica set
set-failover-priority
cartridge replicasets set-failover-priority INSTANCE_NAME... [flags]
Configure replica set failover priority.
Flags:
--replicaset
Name of the replica set
cartridge replicasets list-roles [flags]
List the available roles.
list-vshard-groups
cartridge replicasets list-vshard-groups [flags]
List the available vshard groups.
add-roles
cartridge replicasets add-roles [ROLE_NAME...] [flags]
Add roles to the replica set.
Flags:
--replicaset
Name of the replica set
--vshard-group
Vshard group for vshard-storage
replica sets
remove-roles
cartridge replicasets remove-roles [ROLE_NAME...] [flags]
Remove roles from the replica set.
Flags:
--replicaset
Name of the replica set
set-weight
cartridge replicasets set-weight WEIGHT [flags]
Specify replica set weight.
Flags:
--replicaset
Name of the replica set
set-failover-priority
cartridge replicasets set-failover-priority INSTANCE_NAME... [flags]
Configure replica set failover priority.
Flags:
--replicaset
Name of the replica set
cartridge replicasets list-vshard-groups [flags]
List the available vshard groups.
add-roles
cartridge replicasets add-roles [ROLE_NAME...] [flags]
Add roles to the replica set.
Flags:
--replicaset
Name of the replica set
--vshard-group
Vshard group for vshard-storage
replica sets
remove-roles
cartridge replicasets remove-roles [ROLE_NAME...] [flags]
Remove roles from the replica set.
Flags:
--replicaset
Name of the replica set
set-weight
cartridge replicasets set-weight WEIGHT [flags]
Specify replica set weight.
Flags:
--replicaset
Name of the replica set
set-failover-priority
cartridge replicasets set-failover-priority INSTANCE_NAME... [flags]
Configure replica set failover priority.
Flags:
--replicaset
Name of the replica set
cartridge replicasets add-roles [ROLE_NAME...] [flags]
Add roles to the replica set.
Flags:
--replicaset |
Name of the replica set |
--vshard-group |
Vshard group for vshard-storage replica sets |
remove-roles
cartridge replicasets remove-roles [ROLE_NAME...] [flags]
Remove roles from the replica set.
Flags:
--replicaset
Name of the replica set
set-weight
cartridge replicasets set-weight WEIGHT [flags]
Specify replica set weight.
Flags:
--replicaset
Name of the replica set
set-failover-priority
cartridge replicasets set-failover-priority INSTANCE_NAME... [flags]
Configure replica set failover priority.
Flags:
--replicaset
Name of the replica set
cartridge replicasets remove-roles [ROLE_NAME...] [flags]
Remove roles from the replica set.
Flags:
--replicaset |
Name of the replica set |
set-weight
cartridge replicasets set-weight WEIGHT [flags]
Specify replica set weight.
Flags:
--replicaset
Name of the replica set
set-failover-priority
cartridge replicasets set-failover-priority INSTANCE_NAME... [flags]
Configure replica set failover priority.
Flags:
--replicaset
Name of the replica set
cartridge replicasets set-weight WEIGHT [flags]
Specify replica set weight.
Flags:
--replicaset |
Name of the replica set |
set-failover-priority
cartridge replicasets set-failover-priority INSTANCE_NAME... [flags]
Configure replica set failover priority.
Flags:
--replicaset
Name of the replica set
cartridge replicasets set-failover-priority INSTANCE_NAME... [flags]
Configure replica set failover priority.
Flags:
--replicaset |
Name of the replica set |