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 keyspace command

This command allows you to view your keyspaces and view or update your Vitess VSchemas. This command is not available for Postgres databases. Usage:
pscale keyspace <SUB-COMMAND> <FLAG>

Available sub-commands

Sub-commandSub-command flagsProductDescription
create <DATABASE_NAME> <BRANCH_NAME> <KEYSPACE_NAME>--cluster-size <SIZE>, --additional-replicas <NUMBER>, --shards <NUMBER>VitessCreate a new keyspace within a database branch.
list <DATABASE_NAME> <BRANCH_NAME>VitessList all keyspaces within a database branch.
show <DATABASE_NAME> <BRANCH_NAME> <KEYSPACE_NAME>VitessShow a specific keyspace within a database branch.
resize <DATABASE_NAME> <BRANCH_NAME> <KEYSPACE_NAME>--cluster-size <SIZE>, --additional-replicas <NUMBER>VitessResize a keyspace.
resize cancel <DATABASE_NAME> <BRANCH_NAME> <KEYSPACE_NAME>VitessCancel an ongoing keyspace resize.
resize status <DATABASE_NAME> <BRANCH_NAME> <KEYSPACE_NAME>VitessShow the status of the keyspace’s last resize.
settings <DATABASE_NAME> <BRANCH_NAME> <KEYSPACE_NAME>VitessShow the settings for a keyspace.
update-settings <DATABASE_NAME> <BRANCH_NAME> <KEYSPACE_NAME>-i, --interactive, --replication-durability-constraints-strategy <STRATEGY>, --vreplication-batch-replication-events, --vreplication-enable-noblob-binlog-mode, --vreplication-optimize-insertsVitessUpdate the settings for a keyspace.
vschema show <DATABASE_NAME> <BRANCH_NAME> <KEYSPACE_NAME>VitessShow the VSchema for a sharded keyspace. Empty on non-sharded keyspaces.
vschema update <DATABASE_NAME> <BRANCH_NAME> <KEYSPACE_NAME>--vschema <FILE>*VitessUpdate a VSchema of a keyspace.
rollout-status <DATABASE_NAME> <BRANCH_NAME> <KEYSPACE_NAME>VitessCheck the status of a keyspace resize request.
* Flag is required

Sub-command flag descriptions

Sub-command flagDescriptionApplicable sub-commands
--additional-replicas <NUMBER><NUMBER> is the number of replicas to add to the keyspace. By default, production branches include 2 replicas.create, resize
--cluster-size <SIZE><SIZE> is the size of the database cluster.create, resize
-i, --interactiveRun the command in interactive mode.update-settings
--replication-durability-constraints-strategy <STRATEGY>Replication strategy to use. Options: maximum, dynamic, minimum (default “maximum”).update-settings
--shards <NUMBER>Number of shards in the keyspace (default 1).create
--vreplication-batch-replication-eventsWhen enabled, sends fewer queries to MySQL to improve performance.update-settings
--vreplication-enable-noblob-binlog-modeWhen enabled, omits changed BLOB and TEXT columns from replication events, which reduces binlog sizes. (default true)update-settings
--vreplication-optimize-insertsWhen enabled, skips sending INSERT events for rows that have yet to be replicated. (default true)update-settings
--vschema <FILE><FILE> is the path to the updated VSchema file.vschema update

Available flags

FlagDescription
-h, --helpView help for auth command
--org <ORGANIZATION_NAME>The organization for the current user

Global flags

CommandDescription
--api-token <TOKEN>The API token to use for authenticating against the PlanetScale API.
--api-url <URL>The base URL for the PlanetScale API. Default is https://api.planetscale.com/.
--config <CONFIG_FILE>Config file. Default is $HOME/.config/planetscale/pscale.yml.
--debugEnable debug mode.
-f, --format <FORMAT>Show output in a specific format. Possible values: human (default), json, csv.
--no-colorDisable color output.
--service-token <TOKEN>The service token for authenticating.
--service-token-id <TOKEN_ID>The service token ID for authenticating.

Need help?

Get help from the PlanetScale Support team, or join our GitHub discussion board to see how others are using PlanetScale.