问题描述
我想在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 Admin API 来启动和停止Cloud SQL实例(您将需要2个Cloud函数).您可以看到有关如何使用云功能启动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数据库的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!