mirror of
https://github.com/imjasonh/gcloud-help
synced 2026-07-08 18:45:13 +00:00
189 lines
8.1 KiB
Text
189 lines
8.1 KiB
Text
NAME
|
|
gcloud alpha sql instances clone - clones a Cloud SQL instance
|
|
|
|
SYNOPSIS
|
|
gcloud alpha sql instances clone SOURCE DESTINATION
|
|
[--allocated-ip-range-name=ALLOCATED_IP_RANGE_NAME] [--async]
|
|
[--destination-network=DESTINATION_NETWORK]
|
|
[--destination-project=DESTINATION_PROJECT]
|
|
[--preferred-secondary-zone=PREFERRED_SECONDARY_ZONE]
|
|
[--preferred-zone=PREFERRED_ZONE]
|
|
[--source-instance-deletion-time=SOURCE_INSTANCE_DELETION_TIME]
|
|
[--bin-log-file-name=BIN_LOG_FILE_NAME
|
|
--bin-log-position=BIN_LOG_POSITION | [--point-in-time=POINT_IN_TIME
|
|
: --restore-database-name=RESTORE_DATABASE_NAME]]
|
|
[GCLOUD_WIDE_FLAG ...]
|
|
|
|
DESCRIPTION
|
|
(ALPHA) gcloud alpha sql instances clone creates a clone of a Cloud SQL
|
|
instance. The clone is an independent copy of the source instance with the
|
|
same data and settings. Source and destination instances must be in the
|
|
same project. An instance can be cloned from its current state, or from an
|
|
earlier point in time.
|
|
|
|
For MySQL: The binary log coordinates or timestamp (point in time), if
|
|
specified, act as the point in time the source instance is cloned from. If
|
|
not specified, the current state of the instance is cloned.
|
|
|
|
For PostgreSQL: The point in time, if specified, defines a past state of
|
|
the instance to clone. If not specified, the current state of the instance
|
|
is cloned.
|
|
|
|
For SQL Server: The point in time, if specified, defines a past state of
|
|
the instance to clone. If not specified, the current state of the instance
|
|
is cloned.
|
|
|
|
Note: The flags --destination-project and --destination-network are
|
|
currently for allowlisted customers only.
|
|
|
|
EXAMPLES
|
|
To clone an instance from its current state (most recent binary log
|
|
coordinates):
|
|
|
|
$ gcloud alpha sql instances clone my-source-instance \
|
|
my-cloned-instance
|
|
|
|
To clone a MySQL instance from an earlier point in time (past binary log
|
|
coordinates):
|
|
|
|
$ gcloud alpha sql instances clone my-source-instance \
|
|
my-cloned-instance --bin-log-file-name mysql-bin.000020 \
|
|
--bin-log-position 170
|
|
|
|
To clone a MySQL source instance at a specific point in time:
|
|
|
|
$ gcloud alpha sql instances clone my-source-instance \
|
|
my-cloned-instance --point-in-time '2012-11-15T16:19:00.094Z'
|
|
|
|
To clone a PostgreSQL source instance at a specific point in time:
|
|
|
|
$ gcloud alpha sql instances clone my-source-instance \
|
|
my-cloned-instance --point-in-time '2012-11-15T16:19:00.094Z'
|
|
|
|
To clone a SQL Server source instance at a specific point in time:
|
|
|
|
$ gcloud alpha sql instances clone my-source-instance \
|
|
my-cloned-instance --point-in-time '2012-11-15T16:19:00.094Z'
|
|
|
|
To clone a deleted instance, include the name and deletion time of the
|
|
source instance:
|
|
|
|
$ gcloud alpha sql instances clone my-source-instance \
|
|
my-cloned-instance \
|
|
--source-instance-deletion-time '2012-11-15T16:19:00.094Z'
|
|
|
|
To specify the allocated IP range for the private IP target Instance
|
|
(reserved for future use):
|
|
|
|
$ gcloud alpha sql instances clone my-source-instance \
|
|
my-cloned-instance \
|
|
--allocated-ip-range-name cloned-instance-ip-range
|
|
|
|
POSITIONAL ARGUMENTS
|
|
SOURCE
|
|
Cloud SQL instance ID of the source.
|
|
|
|
DESTINATION
|
|
Cloud SQL instance ID of the clone.
|
|
|
|
FLAGS
|
|
--allocated-ip-range-name=ALLOCATED_IP_RANGE_NAME
|
|
The name of the IP range allocated for the destination instance with
|
|
private network connectivity. For example:
|
|
'google-managed-services-default'. If set, the destination instance IP
|
|
is created in the allocated range represented by this name. Reserved
|
|
for future use.
|
|
|
|
--async
|
|
Return immediately, without waiting for the operation in progress to
|
|
complete.
|
|
|
|
--destination-network=DESTINATION_NETWORK
|
|
The fully qualified URI of the VPC network to which the cloned instance
|
|
will be connected via Private Services Access for private IP. For
|
|
example: projects/my-network-project/global/networks/my-network. This
|
|
field is required only for cross-project cloning.
|
|
|
|
--destination-project=DESTINATION_PROJECT
|
|
The project ID of the destination project where the cloned instance
|
|
will be created. To perform a cross-project clone, this field is
|
|
required. If not specified, the clone is created in the same project as
|
|
the source instance.
|
|
|
|
--preferred-secondary-zone=PREFERRED_SECONDARY_ZONE
|
|
The preferred secondary zone for the cloned regional instance. If you
|
|
specify a value for this flag, then the destination instance uses the
|
|
value as the secondary zone. The secondary zone can't be the same as
|
|
the primary zone.
|
|
|
|
--preferred-zone=PREFERRED_ZONE
|
|
The preferred zone for the cloned instance. If you specify a value for
|
|
this flag, then the destination instance uses the value as the primary
|
|
zone.
|
|
|
|
--source-instance-deletion-time=SOURCE_INSTANCE_DELETION_TIME
|
|
The time the source instance was deleted. This is required if cloning
|
|
from a deleted instance.
|
|
|
|
At most one of these can be specified:
|
|
|
|
Binary log coordinates for point-in-time recovery.
|
|
|
|
--bin-log-file-name=BIN_LOG_FILE_NAME
|
|
The name of the binary log file. Enable point-in-time recovery on the
|
|
source instance to create a binary log file. If specified with
|
|
<--bin-log-position> to form a valid binary log coordinate, it
|
|
defines an earlier point in time to clone a source instance from. For
|
|
example, mysql-bin.000001.
|
|
|
|
This flag argument must be specified if any of the other arguments in
|
|
this group are specified.
|
|
|
|
--bin-log-position=BIN_LOG_POSITION
|
|
Represents the state of an instance at any given point in time inside
|
|
a binary log file. If specified along with <--bin-log-file-name> to
|
|
form a valid binary log coordinate, it defines an earlier point in
|
|
time to clone a source instance from. For example, 123 (a numeric
|
|
value).
|
|
|
|
This flag argument must be specified if any of the other arguments in
|
|
this group are specified.
|
|
|
|
--point-in-time=POINT_IN_TIME
|
|
Represents the state of an instance at any given point in time inside
|
|
a transaction log file. For MySQL, the binary log file is used for
|
|
transaction logs. For PostgreSQL, the write-ahead log file is used
|
|
for transaction logs. For SQL Server, the log backup file is used for
|
|
such purpose. To create a transaction log, enable point-in-time
|
|
recovery on the source instance. Instance should have transaction
|
|
logs accumulated up to the point in time they want to restore up to.
|
|
Uses RFC 3339 format in UTC timezone. If specified, defines a past
|
|
state of the instance to clone. For example,
|
|
'2012-11-15T16:19:00.094Z'.
|
|
|
|
This flag argument must be specified if any of the other arguments in
|
|
this group are specified.
|
|
|
|
--restore-database-name=RESTORE_DATABASE_NAME
|
|
The name of the database to be restored for a point-in-time restore.
|
|
If set, the destination instance will only restore the specified
|
|
database.
|
|
|
|
GCLOUD WIDE FLAGS
|
|
These flags are available to all commands: --access-token-file, --account,
|
|
--billing-project, --configuration, --flags-file, --flatten, --format,
|
|
--help, --impersonate-service-account, --log-http, --project, --quiet,
|
|
--trace-token, --user-output-enabled, --verbosity.
|
|
|
|
Run $ gcloud help for details.
|
|
|
|
NOTES
|
|
This command is currently in alpha and might change without notice. If this
|
|
command fails with API permission errors despite specifying the correct
|
|
project, you might be trying to access an API with an invitation-only early
|
|
access allowlist. These variants are also available:
|
|
|
|
$ gcloud sql instances clone
|
|
|
|
$ gcloud beta sql instances clone
|
|
|