REDIS连接超时在AWS EC2上运行
我在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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论