简体   繁体   English

在 GCP 帐户之间迁移 MySQL 数据库的最佳方法是什么?

[英]What is the best approach to migrate MySQL database between GCP Accounts?

I need to clone a MySQL database in one GCP to another GCP account.我需要将一个 GCP 中的 MySQL 数据库克隆到另一个 GCP 帐户。

The most obvious way I can think of is exporting MySQL and then importing it another account.我能想到的最明显的方法是导出 MySQL 然后导入另一个帐户。

What are other alternatives?还有什么其他选择?

Go to Cloud SQL page in the console and chose migrate data . Go 到 Cloud SQL 页面在控制台并选择migrate data Here you have several cases of migration, and among them this one which match your requirement:这里有几个迁移案例,其中一个符合您的要求:

  • Google Cloud project to Google Cloud project谷歌云项目到谷歌云项目

Move an instance from another Google Cloud project into this one将另一个 Google Cloud 项目中的实例移动到该项目中

You can choose to set this read replica as master (and thus to finish the migration), or you can keep the state of read replica and your clone will be always the image of your original project.您可以选择将此只读副本设置为主副本(从而完成迁移),或者您可以保留只读副本的 state,您的克隆将始终是原始项目的映像。 Here the described steps:这里描述的步骤:

The Cloud SQL Migration Assistant will guide you through the following steps: Cloud SQL 迁移助手将指导您完成以下步骤:

  • Providing details on your data source提供有关数据源的详细信息
  • Creating a Cloud SQL read replica创建云 SQL 只读副本
  • Synchronising the read replica with the source将只读副本与源同步
  • Promoting the read replica to your primary instance (optional)将只读副本提升到您的主实例(可选)

1. Export data to Cloud Storage in the source account 1. 将数据导出到源账户中的 Cloud Storage

Choose Cloud Storage export location, Format选择 Cloud Storage 导出位置、格式

The SQL export process may take a long time (possibly an hour or more for large instances). SQL 导出过程可能需要很长时间(大型实例可能需要一个小时或更长时间)。 You will not be able to perform operations on your instance for the entire duration of the export.在整个导出期间,您将无法对您的实例执行操作。 Once begun, this process cannot be canceled.一旦开始,这个过程就不能被取消。

2. Copy the exported dump file to destination account 2. 将导出的转储文件复制到目标账户

a.一个。 Create a bucket创建存储桶

b.湾。 Edit bucket permissions编辑存储桶权限

c. c。 Add member添加成员

d. d。 Enter the mail source account输入邮件来源帐号

e. e. Select Role Select 角色

Copy the file from soure account to destination account:将文件从源帐户复制到目标帐户:

gsutil mv gs://source/export gs://destination/export

If the dump file is to big use: Cloud Data Transfer如果转储文件很大,请使用:Cloud Data Transfer

3. Select Cloud SQL Migrate data 3. Select 云 SQL 迁移数据

Begin Migration开始迁移

a.一个。 Choose Data Source Details: Name of data source, Public IP address of source, Port number of source, MySQL replication username, Password,选择数据源详细信息:数据源名称、Public IP 源地址、源端口号、MySQL 复制用户名、密码、

b.湾。 Create and configure a new Cloud SQL read replica of the external primary instance.创建并配置外部主实例的新 Cloud SQL 只读副本。 Choose Read replica instance ID, Location, Region, Machine type, Storage type, Storage capacity, Import SQL dump from Google Cloud Storage选择只读副本实例 ID、位置、区域、机器类型、存储类型、存储容量、从 Google Cloud Storage 导入 SQL 转储

c. c。 Data synchronization数据同步

d. d。 Read replica promotion (optional)只读副本提升(可选)

Try to use google could service:尝试使用谷歌可以服务:

CLOUD DATA TRANSFER云数据传输

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将本地数据库sqlite与生产服务器(MySQL)同步的最佳方法是什么? - What is the best approach for sync local database sqlite with Production server (MySQL)? 在实时环境中从MySQL迁移到SQL Server的最佳方法 - Best Approach to Migrate from MySQL to SQL server on Live Environment 大型MySQL数据库表的最佳方法 - Best Approach for large MySQL database table 设置此数据库模型(MySQL)的最佳方法? - Best approach to set up this database model (MySQL)? .net核心数据库托管的最佳方法是什么? - What is the best approach for .net core database hosting? 升级数据库时使用的最佳方法是什么 - What is the best approach to use when upgrading a Database 什么是锁定mysql数据库的最佳方法。 没有创建更新和删除操作 - what is the best approach to lock the mysql database. no create update and delete opparation 通过PHP向MySQL数据库添加100,000多条记录的最佳方法是什么? - What would be the best approach of adding 100,000+ records to a MySQL database via PHP? 使用 Mysql 时在 SailsJS 应用程序中安全迁移数据库的最佳实践 - Best Practice to Safely Migrate Database in SailsJS App when using Mysql 将Django DB从SQLite迁移到MySQL的最佳方法是什么? - What's the best way to migrate a Django DB from SQLite to MySQL?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM