Adding a Redis instance
Now, let's connect RedisInsight to a Redis Server. We can start by connecting to redis server running on localhost.
If the connection is successful, you should start seeing statistics for this redis server.
- RedisInsight can only connect to redis servers that your redis-cli can connect to.
If RedisInsight cannot connect to your redis server, check if you can connect using
- On mac and windows, if localhost does not work, try
host.docker.internalas the server name.
- On linux, if localhost does not work, restart docker with the
--network hostflag in the docker run command.
Connecting to ElastiCache
If you want to work with ElastiCache Redis instances with RedisInsight, you have two options:
- Install RedisInsight on an EC2 instance that has access to the ElastiCache Redis instance.
- Create a SSH tunnel through an EC2 instance that can access the ElastiCache Redis instance.
Using an SSH Tunnel
If you want to add and work with an ElastiCache Redis instance but you're running RedisInsight outside AWS, you can still connect to it through an EC2 instance that can access it. This can be done by creating a SSH tunnel. An SSH tunnel consists of an encrypted tunnel created through an SSH protocol connection. An SSH tunnel can be used to transfer unencrypted traffic over a network through an encrypted channel.
Run this command to create an ssh tunnel:
ssh -f -N -L8765:<elasticache_endpoint> \ -i ~/.ssh/redisinsight-dev.pem <ec2_endpoint>
Go to Add Instance in RedisInsight and add an instance with host=localhost, port=8765, name=your_instance_name
You are now connected to your elasticache instance and can start using it locally.