阅读背景:

Google Cloud功能无法连接到Redis

来源:互联网 

We have a Google Cloud Function that tries to connect to a Redis server that sits on a Compute Engine instance. The Compute Engine Redis port is open and can connect to the Redis server from our local machines. Nonetheless, when the Cloud Function tries to do so, it gets the following error:

我们有一个Google Cloud功能,它尝试连接到位于Compute Engine实例上的Redis服务器。 Compute Engine Redis端口已打开,可以从本地计算机连接到Redis服务器。尽管如此,当Cloud Function尝试这样做时,会收到以下错误:

Redis connection to 35.xxx.xx.xx:6379 failed - connect ETIMEDOUT 35.xxx.xx.xx:6379 at Object.exports._errnoException (util.js:1020:11) at exports._exceptionWithHostPort (util.js:1043:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1105:14) code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'connect', address: '35.xxx.xx.xx', port: 6379 }

Redis连接到35.xxx.xx.xx:6379失败 - 在exports._exceptionWithHostPort(util.js:1043)的Object.exports._errnoException(util.js:1020:11)处连接ETIMEDOUT 35.xxx.xx.xx:6379 :20)在TCPConnectWrap.afterConnect [as oncomplete](net.js:1105:14)代码:'ETIMEDOUT',错误:'ETIMEDOUT',系统调用:'connect',地址:'35 .xxx.xx.xx',港口:6379}

We are using the redis npm package (Redis Node Client) to connect which again works from our local machines.

我们正在使用redis npm软件包(Redis Node Client)进行连接,这可以从我们的本地机器再次运行。

We pass the IP of the EC server to the host value and the authentication secret to the password value. Again this seems to work locally.

我们将EC服务器的IP传递给主机值,将身份验证机密传递给密码值。这似乎在本地工作。

Any ideas?

有任何想法吗?

1 个解决方案

#1


2  

After all, it was indeed a firewall issue. We didn't have the correct service account setup.

毕竟,这确实是一个防火墙问题。我们没有正确的服务帐户设置。

One needs to visit the firewall rules config page and add the appropriate Source Filter (or Second source filter) to type Service Account and add the service account of the Cloud Functions.

需要访问防火墙规则配置页面并添加适当的源过滤器(或第二个源过滤器)以键入服务帐户并添加云功能的服务帐户。


分享到: