从Cloud Run连接到Memorystore [英] Connect to Memorystore from Cloud Run
问题描述
我想在使用Cloud Memorystore作为缓存的Google Cloud Run上运行一项服务.
I want to run a service on Google Cloud Run that uses Cloud Memorystore as cache.
我在与Cloud Run相同的区域中创建了一个Memorystore实例,并使用示例代码进行了连接:
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访问Connectore,但无济于事.我在没有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访问具有Beta支持.有关更多信息,请参见连接到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:
- 使用 Anthos的Cloud Run ,其中 GKE提供了连接到Memorystore的功能(如果为此配置了群集.
- 留在完全托管的Serverless中,但使用带有Memorystore的App Engine .
- 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屋!