Redis Role¶
Overview¶
This role deploys Redis, an in-memory data store, with the RedisInsight GUI for testing caching, queues, and key-value storage. It supports rootless Podman deployment, password authentication, and configurable memory limits with eviction policies.
Requirements¶
- Podman 4.x or later
- Systemd
- A user with sudo access
Installation / Quick Start¶
Orchestrator¶
# Prepare
./manage-svc.sh redis prepare
# Deploy
./manage-svc.sh redis deploy
# Verify
./svc-exec.sh redis verify
Role Variables / Configuration¶
Key Variables¶
| Name | Description | Default |
|---|---|---|
redis_state |
present to install, absent to remove. |
present |
redis_data_dir |
The directory to store Redis data. | "~/redis-data" |
redis_port |
The port for the Redis server. | 6379 |
redis_gui_port |
The port for the RedisInsight GUI. | 8081 |
redis_password |
The password for Redis authentication. | your_secure_password |
redis_maxmemory |
The maximum amount of memory Redis will use. | 256mb |
redis_maxmemory_policy |
The policy to use when maxmemory is reached. |
allkeys-lru |
Memory Policies¶
allkeys-lru: Evict least recently used keys.volatile-lru: Evict LRU keys with expire set.allkeys-random: Evict random keys.volatile-ttl: Evict keys with shortest TTL.noeviction: Return errors when memory limit is reached.
Usage¶
Access¶
- Redis server:
localhost:6379 - RedisInsight GUI:
http://localhost:8081
CLI Examples¶
# Connect to Redis
podman exec -it redis-svc redis-cli -a your_password
# Set a key
redis-cli -a your_password SET mykey "Hello"
# Get a key
redis-cli -a your_password GET mykey
RedisInsight¶
- Open
http://localhost:8081in your browser. - Add a database connection to
localhost:6379. - Enter the configured password.
- Browse keys and monitor performance.
Service Management¶
# Check status
systemctl --user status redis-pod
# View logs
podman logs redis-svc
podman logs redisinsight
# Restart
systemctl --user restart redis-pod
Troubleshooting¶
Memory Issues¶
- Check memory usage:
redis-cli -a your_password INFO memory - Increase
redis_maxmemoryif needed.
Connection Refused¶
- Check that the service is running.
- Verify port bindings:
podman port redis-svc. - Check firewall rules.
Role-Specific Sections¶
Performance Testing¶
Backup¶
- RDB Snapshot: Trigger with
redis-cli -a your_password BGSAVEthen copy~/redis-data/dump.rdb. - AOF Backup: Copy
~/redis-data/appendonly.aof.
Removal¶
# Keep data
./manage-svc.sh redis remove
# Delete all
./manage-svc.sh redis remove -e redis_delete_data=true
Reference¶
License¶
MIT
Author¶
Created by jackaltx and Claude.