Reshard
split or merge shards in a keyspace
Command #
Reshard [-skip_schema_copy] <keyspace.workflow> <source_shards> <target_shards>
Description #
Reshard support horizontal sharding by letting you change the sharding ranges of your existing keyspace.
Parameters #
-skip_schema_copy #
optional
default false
If true the source schema is copied to the target shards. If false, you need to create the tables
before calling reshard.
keyspace.workflow #
mandatory
Name of keyspace being sharded and the associated workflow name, used in later commands to refer back to this reshard.
source_shards #
mandatory
Comma separated shard names to reshard from.
target_shards #
mandatory
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 or VExec
- 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