DROP VIRTUAL CLUSTER

On this page Carat arrow pointing down
Note:

This feature is in preview. This feature is subject to change. To share feedback and/or issues, contact Support.

Note:

This is an enterprise-only feature. Request a 30-day trial license to try it out.

New in v23.2: The DROP VIRTUAL CLUSTER statement removes virtual clusters. Virtual clusters are used only as part of the physical cluster replication workflow.

Physical cluster replication happens between an active primary cluster and a passive standby cluster that accepts updates from the primary cluster. The unit of replication is a virtual cluster, which is part of the underlying infrastructure in the primary and standby clusters. The CockroachDB cluster has:

  • The system virtual cluster manages the cluster's control plane and the replication of the cluster's data. Admins connect to the system virtual cluster to configure and manage the underlying CockroachDB cluster, set up physical cluster replication, create and manage a virtual cluster, and observe metrics and logs for the CockroachDB cluster and each virtual cluster.
  • Each other virtual cluster manages its own data plane. Users connect to a virtual cluster by default, rather than the system virtual cluster. To connect to the system virtual cluster, the connection string must be modified. Virtual clusters contain user data and run application workloads. When physical cluster replication is enabled, the non-system virtual cluster on both primary and secondary clusters is named application.

For more detail, refer to the Physical Cluster Replication Overview.

Warning:

The DROP VIRTUAL CLUSTER statement will delete all data related to the specified virtual cluster.

Required privileges

DROP VIRTUAL CLUSTER requires one of the following privileges:

  • The admin role.
  • The MANAGEVIRTUALCLUSTER system privilege allows the user to run all the related VIRTUAL CLUSTER SQL statements for physical cluster replication.

Use the GRANT SYSTEM statement:

icon/buttons/copy
GRANT SYSTEM MANAGEVIRTUALCLUSTER TO user;

Synopsis

DROP VIRTUAL CLUSTER IF EXISTS virtual_cluster_spec IMMEDIATE

Parameters

Parameter Description
IF EXISTS Drop a virtual cluster if it exists. If it does not exist, do not return an error.
virtual_cluster_spec The name of the virtual cluster.
IMMEDIATE Drop a virtual cluster immediately instead of waiting for garbage collection (GC TTL).

Examples

Remove a virtual cluster

To remove a virtual cluster from a CockroachDB cluster:

icon/buttons/copy
DROP VIRTUAL CLUSTER IF EXISTS application;

Remove a virtual cluster without waiting for garbage collection

Use IMMEDIATE to drop a virtual cluster instead of waiting for data to be garbage collected:

icon/buttons/copy
DROP VIRTUAL CLUSTER IF EXISTS application IMMEDIATE;

See also


Yes No
On this page

Yes No