This guide shows you how to configure instance replication to pair a source instance with a standby replica. You can use instance replication in the following scenarios:
- Protect instances against outages: Maintain a continuously updated cross-region failover instance for disaster recovery.
- Migrate data: Promote a standby replica to permanently migrate an instance to a new location with minimal downtime.
- Run operational tests: Pause replication to temporarily mount the replica and run isolated disaster recovery drills or test workloads without affecting your primary instance.
Before you begin
Create a Filestore instance to use as a source instance for your replica.
Enable APIs
Enable the Filestore API.
Roles required to enable APIs
To enable APIs, you need the serviceusage.services.enable permission. If you
created the project, then you likely already have this permission through the
Owner role (roles/owner). Otherwise, you can get this permission through the
Service Usage Admin role (roles/serviceusage.serviceUsageAdmin).
Learn how to grant roles.
Required roles
To get the permissions that you need to configure instance replication and monitor replicas, ask your administrator to grant you the following IAM roles on your project:
-
Create and manage Filestore instances:
Cloud Filestore Editor (
roles/file.editor) -
View instance replication metrics:
Monitoring Viewer (
roles/monitoring.viewer) -
Create and manage metrics dashboards:
Monitoring Editor (
roles/monitoring.editor)
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
If you are creating a cross-project replica, you must have the Cloud Filestore Editor (roles/file.editor) role on set on both the source and replica projects. This role includes the file.instances.create permission, which is required on the source project to create a cross-project replica.
Create an instance replica
You can't use Google Cloud console to create a cross-project replica. Instead, use gcloud CLI or REST API.
Google Cloud console
In the Google Cloud console, go to the Filestore Instances page.
Click the Instance ID of the instance that you want to replicate.
In the instance details page, click the Replications tab.
Click Create replica.
Verify the source instance details, review the supported recovery point objective and click Next.
Create the instance. For more information, see Create an instance. Consider the following:
- The specified capacity must be greater than or equal to the source instance capacity.
- The service tier and Filestore protocol must be the same for source instance and replica.
- For a robust disaster recovery solution, we recommend that you choose a different region for the replica, rather than just a different zone.
Click Next.
Review the details and click Next.
Click Create.
Wait for the operation to complete. When the process finishes, the replica is listed under the source instance on the Replications page. Click the replica Instance ID to view its details.
gcloud
To create a replica instance, run the
filestore instances createcommand.gcloud filestore instances create INSTANCE_ID \ --source-instance=projects/SOURCE_PROJECT_ID/locations/SOURCE_LOCATION/instances/SOURCE_INSTANCE_ID \ --project=REPLICA_PROJECT_ID \ --location=LOCATION \ --network=name="NETWORK" \ --tier=TIER \ --file-share=name="FILE_SHARE_NAME",capacity=FILE_SHARE_SIZE \
Replace the following:
- INSTANCE_ID with the name of the replica instance that you want
to create. For example,
sample-replica. - SOURCE_PROJECT_ID with the project ID of the Google Cloud project where the source instance is located.
- SOURCE_LOCATION with the location where the source instance resides.
- SOURCE_INSTANCE_ID with the name of the source instance
for which you want to create a replica. For example,
sample-instance. - REPLICA_PROJECT_ID with the project ID of the Google Cloud project where you want the replica instance to reside.
- LOCATION with the location where you want the replica
instance to reside, such as
us-central1-a. If the source is in a zonal service tier, you must specify both a region and zone for the replica.