split or merge shards in a keyspace
Starting with Vitess 11.0 you should use the VReplication v2 commands
Reshard -- --v1 [--cells=<cells>] [--tablet_types=<source_tablet_types>] [--skip_schema_copy] [--auto_start] [--stop_after_copy] <keyspace.workflow> <source_shards> <target_shards>
Reshard support horizontal sharding by letting you change the sharding ranges of your existing keyspace.
Comma separated Cell(s) or CellAlias(es) to replicate from.
Source Vitess tablet_type, or comma separated list of tablet types, that should be used for choosing source tablet(s) for the reshard.
If true the source schema is copied to the target shards. If false, you need to create the tables before calling reshard.
If false, streams will start in the Stopped state and will need to be explicitly started (default true).
Streams will be stopped once the copy phase is completed.
Name of keyspace being sharded and the associated workflow name, used in later commands to refer back to this reshard.
Comma separated shard names to reshard from.
Comma separated shard names to reshard to.
A Reshard Workflow #
Once you decide on the new resharding strategy for a keyspace, you need to initiate a VReplication workflow as follows:
- Initiate the migration using Reshard
- Monitor the workflow using Workflow
- Confirm that data has been copied over correctly using VDiff
- Start the cutover by routing all reads from your application to those tables using SwitchReads
- Complete the cutover by routing all writes using SwitchWrites
- Optionally cleanup the source tables using DropSources