将 Azure Web 应用连接到 Azure Redis 缓存

qwe*_*weq 2 python azure redis celery flask

如何将 Azure Redis 缓存连接到使用 celery 执行某些异步任务的 Flask WebApp?每当我尝试通过 Webjob 连接时,都会显示无法连接到 redis。

我也尝试celery inspect ping -b redis://{password}@{redis_service_name}.redis.cache.windows.net:6379/0从这篇文章How to configure celery-redis in django project on microsoft azure? 中输入此内容?但我会得到Connection Failure: If this issue persists, ensure your computer's firewall and proxy settings allow outbound TCP traffic to port 10225. Using the firewall feature on your cache may also block connections from the console if your IP address has not been whitelisted

小智 5

如果防火墙没有特殊规则,应该不会出现这个错误。一般来说,公司网络有特殊的防火墙设置,因此可能会出现访问问题。在这种情况下,您需要允许防火墙出站端口10225。您可以使用 Azure 上的 Redis 控制台在不同的网络上进行测试,看看它是否与防火墙相关。

使用具有防火墙规则的公司网络 使用具有防火墙规则的公司网络

其他没有防火墙规则的网络 在此输入图像描述