1

I'm following GCP tutorial to create a replica instance from an external master. The Cloud SQL API is enabled and I am using google shell from the console to run the commands. I have also tried from a compute engine instance using gcloud auth login to get credentials but run into the exact same issue.

I'm creating the internal master without any issue:

ACCESS_TOKEN="$(gcloud auth application-default print-access-token)"
curl --header "Authorization: Bearer ${ACCESS_TOKEN}" \
 --header 'Content-Type: application/json' \
 --data '{"name": "int-clouddb5",
          "region": "us-central1-a",
          "databaseVersion": "MYSQL_5_5",
          "onPremisesConfiguration": {"hostPort": "79.xx.xx.xx:3306"}}' \
 -X POST \
 https://www.googleapis.com/sql/v1beta4/projects/my-project-222/instances

But then when setting up the replica this way:

curl --header "Authorization: Bearer ${ACCESS_TOKEN}" \
 --header 'Content-Type: application/json' \
 --data '{"replicaConfiguration":
           {"mysqlReplicaConfiguration":
             {"username": "xxxx", "password": "xxxxx",
              "dumpFilePath": "gs://xxxbucket-data/xxxxmpv2.sql" }},
          "settings": {"tier": "D4","activationPolicy": "ALWAYS"},
          "databaseVersion": "MYSQL_5_5",
          "masterInstanceName": "int-clouddb5", "name": "sla-clouddb3"}' \
 -X POST \
 https://www.googleapis.com/sql/v1beta4/projects/xxxxxx/instances

I get the following error message:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "notAuthorized",
    "message": "The client is not authorized to make this request."
   }
  ],
  "code": 403,
  "message": "The client is not authorized to make this request."
 }
}

GCP support suggested to use us-central-1a as they had bugs reported on other regions but that doesn't change anything and the guy doesn't seem to understand my request. Has anyone an idea about what's wrong there?

EDIT: the account used to perform everything is the Owner account, it has all permissions on all projects.

  • Could you let us know the case # for your support interaction? – Nick Mar 3 '17 at 0:35
  • Hi Nick, thanks, here it is : #12163150 ref:_00D00VNwG._5006014tcNq:ref and #12164956 ref:_00D00VNwG._5006014tebB:ref The second ticket is the most relevant imo as I give more details. Thanks for your effort, it felt a bit unsupported. – Vincent Teyssier Mar 3 '17 at 7:03
  • It appears the second case is still open. Be sure to follow up there and if possible self-answer this thread when a solution is found. – Nick Mar 6 '17 at 20:45
  • Got an answer that there is trouble and they don't know when it will be fixed. They advise to do replication for an external master from a compute engine MySQL slave :/ and meanwhile I get charged for the pending creation instances :/ – Vincent Teyssier Mar 6 '17 at 20:48
  • That doesn't seem right at all. You should not be charged for an instance which is not meeting the uptime SLA. You should both communicate your concerns through the support channel and in parallel, open up a ticket with billing to see if they can help out. – Nick Mar 6 '17 at 21:05
0

The sample uses $(gcloud auth application-default print-access-token) to get the access token for the request, so you want to use gcloud auth application-default login, not gcloud auth login. You'll also want to ensure that your account has correct permissions to configure the external master.

  • Thanks. Tried that but same issue. And the account I use is the owner/creator of the Gcp account. Have you succeeded to do an external master? I can't find any example of anyone who did. – Vincent Teyssier Feb 28 '17 at 5:44
  • 1
    Unfortunately there is another issue causing the replication to get stuck in PENDING_CREATE status, which was reported some time back but still appears to be ongoing. – Adam Mar 5 '17 at 21:15
0

As of now, the answer is that Cloud SQL external master replication is broken. The suggestion from the support team are quite... hmmm I let you judge.

*Hello, As per checking with our backend team, there are similary bugs already raised for the concern on the external master replication. The team concerned is already handling this issue however no estimated time of resolution has been provided although this is already on high priority. For the meantime, below workarounds is being suggested:

a.) Use mysqldump with a down time [1]

b.) Use GCE instance for replication [2]*

I hope that this is helpful. Please do let me know if you need further clarification. Sincerely, E. Google Cloud Platform Support

  • This issue of creating replica Cloud SQL instance from an external master as per tutorial was fixed. If still encountering issue, submit an issue report here. – N Singh Jan 28 '18 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.