0
votes

I need to replicate data from local database master (using MySQL 5.6) to Google Cloud SQL slave. I read the google instructions and I did it until now:

  • Installed MySQL 5.6 on local machine and created local instance, database and tables;
  • Set up to use binary files (it´s necessary for replication);
  • Created user "replica" to have access to master;
  • Created backup.sql file using mysqldump and I followed google instructions;
  • Upload this file to Google storage bucket;
  • Created 1º generation instance in google Cloud SQL;
  • Created database into 1º generation instance;
  • Restored backup.sql into database;

Next steps in google instruction is type the code into Google Shell "ACCESS_TOKEN="...

ACCESS_TOKEN="$(gcloud auth application-default print-access-token)"
curl --header "Authorization: Bearer ${ACCESS_TOKEN}" \
  --header 'Content-Type: application/json' \
 --data '{"name": "[INTERNAL_MASTER_INSTANCE_NAME]",
          "region": "[REGION_NAME]",
          "databaseVersion": "[EXTERNAL_MASTER_DATABASE_VERSION]",
          "onPremisesConfiguration": {"hostPort": "[IP_ADDRESS:PORT]"}}' \
 -X POST \
 https://www.googleapis.com/sql/v1beta4/projects/[PROJECT-ID]/instances

But I have a error message "400 - Invalid value for: 5.6.39 is not a valid value". Where can I find "databaseVersion": "[EXTERNAL_MASTER_DATABASE_VERSION]" in MySQL? Someone has step-by-step to configure local database using MySQL to replicate data to Google Cloud SQL?

1

1 Answers

0
votes

Based on the Configuring External Masters documenation, you have 2 options for the databaseVersion:

For databaseVersion, provide the MySQL version of the master instance: MYSQL_5_5 or MYSQL_5_6

Since you are inserting 5.6.39 instead, it's triggering the 400 error.