Splitting a Busy Vitess Shard into Two Without Stopping Writes
How Vitess online resharding copies rows to a new shard and routes traffic during cutover, with monitoring checks and limits.
24 Jun 2026, 12:27 UTC

The problem: one shard cannot absorb the write load
Your busiest MySQL shard is at 85 percent disk and write latency is climbing. Adding read replicas helps reads, but every insert and update still lands on the same node. You need to split the shard into two, yet you cannot afford a maintenance window long enough to dump and reload terabytes of data.
Takeaway: Vitess online resharding copies rows to a new shard through a VReplication stream while the source keeps serving traffic. After the copy catches up, a brief cutover flips shard ownership so writes land on the new topology.
What changes during the split
Vitess uses VReplication, a built-in feature that copies table rows between shards by reading the source MySQL binlog. The VSchema is the routing map that defines the sharding key, such as user_id or tenant_id, and the key ranges owned by each shard. VTGate is the query router that sends each statement to the shard that owns the relevant key range.
When you split one shard into two, the source key range is divided into two target ranges. Rows are copied to the new shards while both old and new shards remain online. VTGate continues routing to the source until cutover, then begins sending affected rows to the correct target shard.
Start the reshard and monitor the copy
Run resharding commands from an admin host with network access to vtctld. You need Vitess operator permissions and write access to the topology store, such as etcd, Consul, or ZooKeeper. Exact flags differ across Vitess major versions, so confirm the syntax for your release before running anything in production.
# Representative command; flags vary by Vitess version
vtctlclient Reshard \
--keyspace \
--source-shard-ranges \
--target-shard-ranges , \
--table
While the copy runs, check progress from the same admin host:
vtctlclient ShardReplicationStatus --keyspace --shard
Expected checks: replication lag should trend toward zero, the VReplication stream should report no errors, and source CPU, disk, and binlog growth should stay within capacity. A large copy adds binlog and network load on the source; unmonitored disk pressure can stall the source shard.
| Phase | Traffic behavior | What to watch |
|---|---|---|
| Copying | Reads and writes stay on the source; target catches up | Replication lag, source binlog size, disk space |
| Cutover | Brief read-only window on the source; VTGate retries in-flight queries | Application retry logic, connection errors, latency |
| After cutover | Writes route to the shard that owns the key range | Query plans, scatter/gather spikes, target shard load |
Cutover is brief, and reversal is not a simple undo
When the target has caught up, Vitess performs a short cutover. The source becomes briefly read-only so the final binlog events can be applied, then VTGate switches ownership to the target shards. Before cutover, the resharding job can usually be paused or reversed. After cutover, moving data back is not a simple undo; it requires a separate reverse resharding operation.
Limitation: queries without the sharding key scatter to every shard
A well-chosen sharding key has high cardinality and even distribution. Queries that include the sharding key route to one shard. Queries without it become scatter/gather queries that fan out to every shard. After a reshard, those queries touch more shards than before, which can overwhelm the cluster if your application relies on them.
Verify before you cut over in production
- Read the VSchema JSON from the topology to confirm the sharding key column and the shard key ranges for the keyspace.
- Run EXPLAIN or inspect the Vitess query plan to verify a sharding-key query routes to one shard instead of scattering to all shards.
- Validate cutover in a staging cluster: make the source read-only, promote the target, and confirm writes land on the new shard.
- Monitor ShardReplicationStatus during the copy and check source disk and binlog growth before scheduling cutover.
Online resharding behavior varies across Vitess major versions. Treat this as a planning guide, not a version-specific runbook, and test the full sequence in staging first.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.