Skip to main content

Getting Started

Make sure to first set up your PlanetScale developer environment. Once you’ve installed the pscale CLI, you can interact with PlanetScale and manage your databases straight from the command line.

The planned-reparent-shard command

Run Vitess PlannedReparentShard on a Vitess database branch. It reparents a healthy shard to a new primary when both the current and new primaries are up and running. Use this for planned maintenance when you want to choose the new primary. Discover tablet aliases with pscale branch vtctl list-tablets before you reparent. Usage:
pscale branch vtctld planned-reparent-shard also works.
PlannedReparentShard briefly interrupts writes on the shard while the primary moves. In-flight transactions may fail; clients should retry. Prefer a quiet window and confirm replica lag is low before you start.
You must be an Organization Administrator or a Database Administrator of the database. Service tokens need write_branch_topology for development branches and write_production_branch_topology for production branches.

Available sub-commands

* Flag is required

Sub-command flag descriptions

Available flags

Global flags

Examples

List tablets, then reparent a shard:
By default the command waits for the async operation to finish. Pass --wait=false to get an operation id immediately, then poll with the PlanetScale status subcommand (this is not a Vitess vtctldclient command — it reads GET .../planned-reparent/:id):

API

  • POST /v1/organizations/:org/databases/:db/branches/:branch/planned-reparent
  • GET /v1/organizations/:org/databases/:db/branches/:branch/planned-reparent/:id
Body fields for create: keyspace, shard, new_primary. The create response is a vtctld operation; poll with the show endpoint or status until it completes. There is no customer-facing EmergencyReparentShard command. PlanetScale handles emergency recovery automatically.

Need help?

Get help from the PlanetScale Support team, or join our Discord community to see how others are using PlanetScale.