gpt4 book ai didi

node.js - Google Cloud Function 无法连接到 Redis

转载 作者:IT王子 更新时间:2023-10-29 05:59:26 26 4
gpt4 key购买 nike

我们有一个 Google Cloud Function,它尝试连接到位于 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 npm 包(Redis Node 客户端)连接,它再次从我们的本地机器上运行。

我们将 EC 服务器的 IP 传递给 host 值,将身份验证 secret 传递给 password 值。同样,这似乎在本地有效。

有什么想法吗?

最佳答案

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

需要访问 firewall rules配置页面并添加适当的源过滤器(或第二个源过滤器)以键入服务帐户并添加 Cloud Functions 的服务帐户。

关于node.js - Google Cloud Function 无法连接到 Redis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50510053/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com