Add a Redis instance
Java Serialized Objects
Use Smaller Keys
Switch to 32 Bits
Upgrade Redis Version
Use Better Serializer
Combine Smaller Strings to Hashes
Switch from Set to Intset for Numeric IDs
Switch to Bloom Filter or HyperLogLog
Shard Big Hash to Small Hash
Convert Hashtable to Ziplist for Hashes
Convert to a List instead of Hash
Compress Field Names
Enable Compression for List
Avoid Dynamic Lua Script
Reclaim Expired Keys Memory Faster
Adding a Redis instance
Now, we will connect Rdbtools to a Redis Server. Let’s start by connecting to redis server running on localhost.
If the connection is successful, you should start seeing statistics for this redis server.
- Rdbtools can only connect to redis servers that you redis-cli can connect to. If Rdbtools 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 RDBTools, you have two options:
- Install RDBTools on an EC2 instance that has access to the ElastiCache Redis instance.
- Create an SSH tunnel through an EC2 instance that can access the ElastiCahe Redis instance
Using an SSH Tunnel
If you want to add and work with an ElastiCache Redis instance but you’re running RDBTools outside AWS, you can still connect to it through an EC2 instance that can access it. This can be done by creating an 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/rdbtools-dev.pem <ec2_endpoint>
Go to Add Instance in Rdbtools 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.
Next: Memory Analysis