Skip to content

Latest commit

 

History

History
121 lines (79 loc) · 4.24 KB

configure-zone.md

File metadata and controls

121 lines (79 loc) · 4.24 KB
title summary toc
CONFIGURE ZONE
Use the CONFIGURE ZONE statement to add, modify, reset, and remove replication zones.
true

Use CONFIGURE ZONE to add, modify, reset, and remove replication zones. 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 rows and secondary indexes is an enterprise-only feature. {{site.data.alerts.end}}

Synopsis

alter_zone_range_stmt ::=

{% include {{ page.version.version }}/sql/diagrams/alter_zone_range.html %}

alter_zone_database_stmt ::=

{% include {{ page.version.version }}/sql/diagrams/alter_zone_database.html %}

alter_zone_table_stmt ::=

{% include {{ page.version.version }}/sql/diagrams/alter_zone_table.html %}

alter_zone_index_stmt ::=

{% include {{ page.version.version }}/sql/diagrams/alter_zone_index.html %}

Required privileges

Currently, only the root user can configure replication zones.

Parameters

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.

Variables

{% include {{ page.version.version }}/zone-configs/variables.md %}

Viewing schema changes

{% include {{ page.version.version }}/misc/schema-change-view-job.md %}

Examples

Edit a replication zone

{% include copy-clipboard.html %}

> ALTER TABLE t CONFIGURE ZONE USING range_min_bytes = 0, range_max_bytes = 90000, gc.ttlseconds = 89999, num_replicas = 4, constraints = '[-region=west]';
CONFIGURE ZONE 1

Edit the default replication zone

{% include {{ page.version.version }}/zone-configs/edit-the-default-replication-zone.md %}

Create a replication zone for a database

{% include {{ page.version.version }}/zone-configs/create-a-replication-zone-for-a-database.md %}

Create a replication zone for a table

{% include {{ page.version.version }}/zone-configs/create-a-replication-zone-for-a-table.md %}

Create a replication zone for a secondary index

{% include {{ page.version.version }}/zone-configs/create-a-replication-zone-for-a-secondary-index.md %}

Create a replication zone for a table or secondary index partition

{% include {{ page.version.version }}/zone-configs/create-a-replication-zone-for-a-table-partition.md %}

Create a replication zone for a system range

{% include {{ page.version.version }}/zone-configs/create-a-replication-zone-for-a-system-range.md %}

Reset a replication zone

{% include {{ page.version.version }}/zone-configs/reset-a-replication-zone.md %}

Remove a replication zone

{% include {{ page.version.version }}/zone-configs/remove-a-replication-zone.md %}

See also