REDIS连接超时在AWS EC2上运行

发布于 2025-01-24 07:46:48 字数 636 浏览 3 评论 0原文

我在AWS EC2(Amazon Linux 2,T3.small)上运行了Redis服务器。安全组是为端口6379上的所有主机(开发目的)配置的,并且在redis conf中,我设置了绑定0.0.0.0.0,并关闭了保护模式。 我可以从python程序中进行直接连接到此redis实例,但是当我在一段时间后检查时,它说

redis.exceptions.connectionerror:错误110连接到EC2-xx-xxx-xxx-xxx-xxx.ap-south- 2.compute.amazonaws.com:6379。连接时间超出

我尝试创建一个新实例,但发生了相同的问题,事件尝试bont 0.0.0.0 :: 1,但没有成功。

Python脚本,我用来连接:

import redis

h="ec2-xx-xxx-xxx-xxx.ap-southeast-2.compute.amazonaws.com"
r = redis.Redis(host=h)
r.mset({"Croatia": "Zagreb", "Bahamas": "Nassau"})
r.get("Bahamas")

I have a redis server running on AWS EC2 (Amazon Linux 2, t3.small). The security group is configured for all hosts (development purpose) on port 6379 and also in redis conf, I have set bind 0.0.0.0 and protected mode off.
Intilally i was able to connect to this redis instance from a python program but when i checked after some time it says

redis.exceptions.ConnectionError: Error 110 connecting to ec2-xx-xxx-xx-xxx.ap-southeast-2.compute.amazonaws.com:6379. Connection timed out

I tried creating a new instance but same problem occurs, event tried bind 0.0.0.0 ::1 but no success.

Python script, I am using to connect:

import redis

h="ec2-xx-xxx-xxx-xxx.ap-southeast-2.compute.amazonaws.com"
r = redis.Redis(host=h)
r.mset({"Croatia": "Zagreb", "Bahamas": "Nassau"})
r.get("Bahamas")

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文