一种自动编写脚本以在gcp中启动和停止sql数据库的方法 [英] a way to script automatically to start and stop the sql database in gcp

查看:62
本文介绍了一种自动编写脚本以在gcp中启动和停止sql数据库的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在gcp的cloud Scheduler中运行作业,以在工作日的工作日启动和停止sql数据库.

i want to run a job in cloud scheduler in gcp to start and stop the sql database in weekdays at working hours.

我已经尝试通过触发云功能并使用pubsub进行尝试,但是我没有找到正确的方法来实现它.

I have tried by triggering cloud function and using pubsub but i am not getting proper way to do it.

推荐答案

为实现此目的,您可以使用云功能以调用启动Cloud SQL实例,然后停止一个Cloud SQL实例

In order to achieve this you can use a Cloud Function to make a call to the Cloud SQL Admin API to start and stop your Cloud SQL instance (you will need 2 Cloud functions). You can see my code on how to use a Cloud Function to start a Cloud SQL instance and stop a Cloud SQL instance

创建Cloud函数后,您可以配置Cloud Scheduler 来触发http每个Cloud函数的地址

After creating your Cloud Function you can configure the Cloud Scheduler to trigger the http address of each Cloud function

这篇关于一种自动编写脚本以在gcp中启动和停止sql数据库的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆