Redis - Connect to Redis using the redis-cli
by
Jeremy Canfield |
Updated: April 15 2024
| Redis articles
If you don't have the Redis CLI installed, check out my article Install redis-cli from source.
This also assumes you have a redis system to connect to. If you want to setup a Redis system, check out my articles.
- Install Redis on Docker
- Amazon Web Services (AWS) Redis serverless cluster
- Amazon Web Services (AWS) Redis dedicated cluster
By default, Redis uses port 6379. If connecting from an Amazon Web Services (AWS) EC2 instance, the aws ec2 authorize-security-group-ingress command can be used to allow inbound connections on port 6379 from the Security Group being used by the EC2 instance.
aws ec2 authorize-security-group-ingress --group-id sg-abdefg123456789ab --protocol tcp --port 6379 --cidr 0.0.0.0/0
If the connection is successful, you should get an interactive redis command prompt.
~]$ redis-cli -h redis.example.com -p 6379
redis.example.com:6379>
Did you find this article helpful?
If so, consider buying me a coffee over at