Updating timezone on Google Cloud SQL automatically - mysql

I'm try to deal with the winter and summer time in a Google Cloud SQL instance. What I'm doing now is changing the flag default_time_zone in the configuration every time the time in my region changes. I need it to do it automatically. What I tried already:
1) Looking for a configuration for Time Zone Name to set "Europe/Paris" instead of "+01:00", but Google Cloud doesn't work with this (there's a request for developers of Google to do it but it's not done yet).
2) Changing with a script with "set global ##time_zone='Europe/Paris'" but it raises:
ERROR 1227 (42000): Access denied; you need (at least one of) the
SUPER privilege(s) for this operation
because GCP doesn't allow use super user on mySQL.
Any idea how to bear with this ?

Unfortunately, as per the documentation:
Automatic adjustment to daylight savings time is not supported; you
must update the default_time_zone flag manually to account for
daylight savings time.
So currently, the only approach is to wait for feedback from the Cloud SQL engineering team in the public Feature Request regarding the daylight saving time support. There's also another Feature Request open to allow changing this yourself in the MySQL time_zone table as per 2), which you might find useful to keep track of by starring it.

Related

Google Cloud SQL: Can I change machine type with zero downtime on my database clients?

I want to update the machine type of my Google Cloud SQL instance, but this takes several minutes to update (second generation instance). The instance will be unavailable until the instance has restarted. Because of this downtime, we have to update the machine type at night time, so our visitors are the least troubled by this update.
Is there a workflow how we can minimise this downtime to zero or maybe a few seconds? I already thought about possible solutions like adding a temporary failover or maybe make use of read replica.
I contacted the support of Google Cloud about this question and they told me that Cloud SQL isn't build to perform this change without downtime. If I want to be able to make these changes, I should look at Cloud Spanner which is a horizontal scalable SQL solution provided by Google.

Minor MYSQL DB upgrade on GCP

There is a bug on the Mysql 5.7.14 regarding password hash and has been fixed on version 5.7.19. But the Mysql in the GCP doesn't have any option to do a minor upgrade. So can anyone suggest how to go about this issue?
Version 5.7.25, which includes the fix for this bug, will be in the next maintenance release later this month.
No you cannot do minor upgrades by yourself inCloud SQL becasue it is a fully managed service by Google and all updates and upgrades are done behind the scenes for their customers instances. These updates can be done at any time during the next maintenance cycle. However, you can control the day and time and specify a maintenance window for the instance in question.
When you specify a maintenance window, Cloud SQL will not initiate the updates outside of that window. This way you can specify the window when there is less or no traffic on your applications which help reduce the disruptive side effects of that maintenance. Maintenance usually takes between 1-3 minutes for the new update to be pushed and the instance become available again.
To specify a maintenance window:
1- Go to the project page and select a project.
2- Click an Instance name.
3- On the Cloud SQL Instance details page, click Edit maintenance preferences.
4- Under Configuration options, open Maintenance.
5- Configure the following options:
Preferred window. Set the day and hour range when updates can occur on this instance.
Order of update. Set the order for updating this instance, in relation to updates to other instances. Set timing to Any, Earlier, or Later. Earlier instances receive updates up to a week earlier than later instances within the same location.
read more on it here.

Long-term access token in API Management REST API

I use API Management REST API to create and manage users, and I have to regenerate the access token every 30 days. It's a bit of a hassle to update my web applications every month.
Is there a better way?
I know I can do it programmatically, too, but I am not sure it's a healthy practice to do it every time.
Whatever you do via APIM SAS token you can do via ARM. With ARM you can create service identity and use it to manage your resources: https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal?view=azure-cli-latest
There's a lot of approaches to handle the access token.
To be simplest, you can put the token to a cache system, and set the expire time (like using SETEX in Redis), which is 30 days after in your case. So after 30 days, your access token will be removed automatically by the cache system.
When you need access token but you found it is missing, it means that the access token has expired or you never generated the access token. Whatever, you can generate the access token in your program and put it to the cache system. After that, in next 30 days, you can always use that access token.
In addition, due to time differences between your machine and the servers, it's recommended that set the expire time in your cache system a little bit before the real expire time. So in your case, you can set the expire time with 29 days in your cache system, which guarantee the access token is absolutely valid in remote server.

Amazon RDS Mysql: Allowing the use of Events and Triggers

Today I attempted to turn on my the Events Scheduler on my Amazon RDS instance.
I received the following error:
Access denied; you need (at least one of) the SUPER privilege(s) for
this operation.
I've been looking a a couple of post around the internet on how to solve this but I haven't found anything of real use. I'm not sure where to even start to figure out a solution because these posts have stated that Amazon doesn't grant SUPER privileges to anyone.
To enable the Event Scheduler on RDS you will need to specify this in a parameter group.
You will need to either create a new parameter group or modify an existing one. This can be done via the web console or, as with many AWS things, via the CLI/API/SDK.
You want to change the value of event_scheduler to either 1 or ON.
Once this has been changed you can then apply the parameter group to an existing database instance either via the console or the CLI/API/SDK.
To make the database pick up the parameter change you will need to reboot the instance.

Google Cloud SQL and time zones

I'm developing an app that meant to run only in Israel.
All of our tables contains times at Israeli time (Tel Aviv time).
because the SQL in GCP doesn't support default timezone and time zone convert I got stuck.
how can I convert times between time zones?
let me remind you that Israel has a light saving time change.
Now you have the ability to set the time zone in Cloud SQL. See https://cloud.google.com/sql/docs/mysql-flags. The limitation is that the time zone needs to be specified as offsets to UTC, such as '+10:00'. It does not support named time zones like 'Europe/Helsinki'.
Cloud SQL now supports named time zones. See a list here: https://cloud.google.com/sql/docs/mysql/flags#timezone-names
When using timezone names, automatic adjustment to daylight saving time is supported.
What is weird is that even though when explaining named time zones it gives the example Europe/London, in the actual list that's missing. The closest equivalent is Europe/Dublin, which is functionally the same although their summer time is considered "standard" so they switch to winter time.
THIS ANSWER IS OBSOLETE
On Google Cloud SQL you cannot currently set your own time zone. If you need to change the time zone on your instance, please get in touch with cloud-sql#google.com.