从 Cloud Run 连接到 Memorystore [英] Connect to Memorystore from Cloud Run

查看:25
本文介绍了从 Cloud Run 连接到 Memorystore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Google Cloud Run 上运行一项使用 Cloud Memorystore 作为缓存的服务.

I want to run a service on Google Cloud Run that uses Cloud Memorystore as cache.

我在与 Cloud Run 相同的区域创建了一个 Memorystore 实例并使用示例代码连接:https://github.com/GoogleCloudPlatform/golang-samples/blob/master/memorystore/redis/main.go 这不起作用.

I created an Memorystore instance in the same region as Cloud Run and used the example code to connect: https://github.com/GoogleCloudPlatform/golang-samples/blob/master/memorystore/redis/main.go this didn't work.

接下来我创建了一个无服务器 VPC 访问连接器,但它没有帮助.我在没有 GKE 集群的情况下使用 Cloud Run,因此我无法更改任何配置.

Next I created a Serverless VPC access Connectore which didn't help. I use Cloud Run without a GKE Cluster so I can't change any configuration.

有没有办法从 Cloud Run 连接到 Memorystore?

Is there a way to connect from Cloud Run to Memorystore?

推荐答案

要将 Cloud Run(全托管式)连接到 Memorystore,您需要使用称为无服务器 VPC 访问"或VPC 连接器"的机制.

To connect Cloud Run (fully managed) to Memorystore you need to use the mechanism called "Serverless VPC Access" or a "VPC Connector".

截至 2020 年 5 月,Cloud Run(全托管式)已对无服务器 VPC 访问提供测试版支持.如需了解详情,请参阅连接到 VPC 网络.

As of May 2020, Cloud Run (fully managed) has Beta support for the Serverless VPC Access. See Connecting to a VPC Network for more information.

使用此 Beta 版的替代方法包括:

Alternatives to using this Beta include:

  • Use Cloud Run for Anthos, where GKE provides the capability to connect to Memorystore if the cluster is configured for it.
  • Stay within fully managed Serverless but use a GA version of the Serverless VPC Access feature by using App Engine with Memorystore.

这篇关于从 Cloud Run 连接到 Memorystore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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