title | summary | toc |
---|---|---|
CONFIGURE ZONE |
Use the CONFIGURE ZONE statement to add, modify, reset, and remove replication zones. |
true |
CONFIGURE ZONE
is a subcommand of the ALTER DATABASE
, ALTER TABLE
, ALTER INDEX
, ALTER PARTITION
, and ALTER RANGE
statements and is used to add, modify, reset, or remove replication zones for those objects. To view details about existing replication zones, see SHOW ZONE CONFIGURATIONS
.
In CockroachDB, you can use replication zones to control the number and location of replicas for specific sets of data, both when replicas are first added and when they are rebalanced to maintain cluster equilibrium.
{{site.data.alerts.callout_info}} Adding replication zones for secondary indexes and partitions is an enterprise-only feature. {{site.data.alerts.end}}
alter_zone_database_stmt ::=
alter_zone_table_stmt ::=
alter_zone_index_stmt ::=
alter_zone_partition_stmt ::=
alter_zone_range_stmt ::=
If the target is a system
range, the system
database, or a table in the system
database, the user must be an admin
. For all other databases and tables, the user must have the CREATE privilege on the target database or table.
{{site.data.alerts.callout_danger}}
Required privileges for CONFIGURE ZONE
statements in CockroachDB v19.2 may be backward-incompatible for users running scripted statements with restricted permissions in v19.1 and earlier.
To add the necessary permissions, use GRANT
<privileges> or GRANT
<roles> as a user with an admin role.
For example, to grant a user the admin role, run GRANT admin TO <user>
.
To grant the CREATE
privilege on a database or table, run GRANT CREATE ON [DATABASE | TABLE] <name> TO <user>
.
{{site.data.alerts.end}}
Parameter | Description
-----------+-------------
range_name
| The name of the system range for which to show replication zone configurations.
database_name
| The name of the database for which to show replication zone configurations.
table_name
| The name of the table for which to show replication zone configurations.
partition_name
| The name of the partition for which to show replication zone configurations.
index_name
| The name of the index for which to show replication zone configurations.
variable
| The name of the variable to change.
value
| The value of the variable to change.
DISCARD
| Remove a replication zone.
{% include {{ page.version.version }}/zone-configs/variables.md %}
{% include {{ page.version.version }}/misc/schema-change-view-job.md %}
{% include {{ page.version.version }}/sql/movr-statements-geo-partitioned-replicas.md %}
{% include copy-clipboard.html %}
> ALTER TABLE users CONFIGURE ZONE USING range_min_bytes = 0, range_max_bytes = 90000, gc.ttlseconds = 89999, num_replicas = 4;
CONFIGURE ZONE 1
{% include {{ page.version.version }}/zone-configs/edit-the-default-replication-zone.md %}
{% include {{ page.version.version }}/zone-configs/create-a-replication-zone-for-a-database.md %}
{% include {{ page.version.version }}/zone-configs/create-a-replication-zone-for-a-table.md %}
{% include {{ page.version.version }}/zone-configs/create-a-replication-zone-for-a-secondary-index.md %}
{% include {{ page.version.version }}/zone-configs/create-a-replication-zone-for-a-table-partition.md %}
{% include {{ page.version.version }}/zone-configs/create-a-replication-zone-for-a-system-range.md %}
{% include {{ page.version.version }}/zone-configs/reset-a-replication-zone.md %}
{% include {{ page.version.version }}/zone-configs/remove-a-replication-zone.md %}