Recreating database with the same instance id

已查看 3,840 次
跳至第一个未读帖子

Michael Strickland

未读,
2017年2月15日 16:04:112017/2/15
收件人 Google Cloud SQL discuss
I originally created a database through the Google Cloud web console, and later attempted to replicate the steps using gcloud on the command line for reproducibility.

I found a gcloud command that works when creating a new instance with a different name, but attempting to delete the original instance I made, and recreate it using gcloud failed with the following error:

gcloud beta sql instances create stg-mysql-us-central1 \
  --database-version MYSQL_5_7 \
  --activation-policy ALWAYS \
  --tier db-n1-standard-8 \
  --region us-central1 \
  --replication SYNCHRONOUS \
  --storage-size 200GB \
  --storage-type SSD \
  --storage-auto-increase 
ERROR: (gcloud.beta.sql.instances.create) Project [MY_PROJECT] is the subject of a conflict: The Cloud SQL instance already exists.

This error occurs using the web console as well if you try to create an instance with a name you used previously, even if you have since deleted the instance.

Is this expected behavior? Can we expect that names can be reused after a given amount of time?

I found an old issue on the google bug tracker mentioning the same behavior, but there wasn't any resolution: https://code.google.com/p/googlecloudsql/issues/detail?id=84

Thanks!
Michael

paynen

未读,
2017年2月15日 19:36:522017/2/15
收件人 Google Cloud SQL discuss
Hey Michael,

I can replicate this behaviour on my end and it doesn't seem right. I'll be looking at this with a colleague who is more of a specialist in Cloud SQL and we'll update this thread when we determine what's going on.

Cheers,

Nick
Cloud Platform Community Support

Pia Chamberlain

未读,
2017年2月16日 11:08:032017/2/16
收件人 Google Cloud SQL discuss
This is expected behavior. From https://cloud.google.com/sql/docs/mysql/delete-instance:

You cannot reuse an instance name for up to a week after you have deleted an instance.

paynen

未读,
2017年2月16日 14:20:132017/2/16
收件人 Google Cloud SQL discuss
Thanks Pia. We'll make sure this information is also available on the create-instances page. It might also be useful to include in the error message shown to the users.


Cheers,

Nick
Cloud Platform Community Support

Leonardo Faoro

未读,
2018年4月13日 08:59:282018/4/13
收件人 Google Cloud SQL discuss
I can't use any name containing similar words:

gcloud sql instances create test1 -> The Cloud SQL instance already exists.
gcloud sql instances create test2 -> The Cloud SQL instance already exists.
gcloud sql instances create test123456 -> The Cloud SQL instance already exists.

Is this behavior expected as well?

Pia Chamberlain

未读,
2018年4月13日 12:20:322018/4/13
收件人 Google Cloud SQL discuss
That would not be expected, no. But I can't reproduce that behavior in my project.

Kurt Josephson

未读,
2018年4月13日 13:29:272018/4/13
收件人 google-cloud...@googlegroups.com
My understanding is that these names need to be unique to all CloudSQL instances.  In this case, you might simply be running up against a whole bunch of other users who decided to use the name 'test' for their first instance and the number got auto-incremented.  It's also possible that this got a little out of hand in terms of overuse of 'test' for an instance name so 'test' + {number} might just not be allowed anymore (but that's pure speculation).  

If you try a naming convention like: {your company name}-test and then try to create {your company name}-test1 it should work just fine.  That way you can still specify that it's a test instance, and then use the {your company name} prefix for future production instances.

Hope this was helpful/correct,

-Kurt

p.s.: I'm not affiliated with google in any way, but have been using CloudSQL for a couple years now and I might be one of the users who created a test+number instance when I first started out :)

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/83528c13-c1bd-4ca9-8aac-18dbae5d02a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

回复全部
回复作者
转发
0 个新帖子