The redis is running in the ec2 instance via daemon
ps aux | grep redis-server
redis 1182 0.0 0.8 38856 8740 ? Ssl 21:40 0:00 /usr/bin/redis-server 127.0.0.1:6379
netstat -nlpt | grep 6379
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN -
tcp6 0 0 :::6379 :::* LISTEN 1388/redis-server *
Temporarily I have set network inbound to all traffic so it is likely not a problem of network security.
Type Protocol Port Range Source Description
All traffic All All 0.0.0.0/0
But when I try to access from the python side:
import redis
r = redis.StrictRedis(host='ec2-xx-xxx-xx-xx.compute-1.amazonaws.com', port=6379, db=0)
r.set('foo', 'bar')
r.get('foo')
I get the following error:
ConnectionError: Error 111 connecting to ec2-xx-xxx-xx-xx.compute-1.amazonaws.com:6379. Connection refused.
What may cause such issue despite network inbound is open to all traffic and redis running fine in the ec2 instance ?