Script Valley
Redis: Complete Course
Redis in Production/Assessment

Practice & Assessment

Test your understanding of Redis in Production

Multiple Choice Questions

5
1

Why should you deploy exactly 3 (or more odd number) Redis Sentinel processes?

2

A Redis Cluster command returns MOVED 7638 192.168.1.20:6380. What should the client do?

3

Which ACL permission syntax restricts a user to only GET commands on keys starting with 'cache:'?

4

What is the risk of running redis-cli MONITOR in production continuously?

5

What metric in INFO stats tells you if your cache is effective?

Coding Challenges

1
1

Sentinel-Aware Client with Automatic Failover

Write a Node.js or Python script that connects to Redis via Sentinel (use ioredis with Sentinel config, or redis-py with Sentinel). The script must: connect using the Sentinel addresses and master name, write 100 keys in a loop with SETEX (TTL 60), then read them back and report how many were found. Simulate a primary failure by stopping the Redis primary process mid-loop and verify the client reconnects to the new primary and completes the operation. Input: array of sentinel host:port strings, master name. Output: count of successful reads. Estimated time: 25 minutes.

Medium

Mini Project

1

Production-Ready Redis Session Service

Build a complete session management microservice using all Module 6 concepts. Requirements: Store sessions as Hashes (userId, createdAt, lastSeen, metadata) with a 30-minute TTL. Use ACL to create a session-service user with HSET, HGETALL, HDEL, EXPIRE permissions on keys matching session:*. Connect via TLS (self-signed cert for local dev). Implement createSession(userId), getSession(token), refreshSession(token) (reset TTL to 30 min), and deleteSession(token). Add a background process using keyspace notifications (KEgx) that listens for expired session keys and logs them to a Redis Stream session:audit with XADD. Write a monitoring function that calls INFO memory and INFO stats and prints hit ratio and memory usage every 30 seconds.

Hard
Practice & Assessment โ€” Redis in Production โ€” Redis: Complete Course โ€” Script Valley โ€” Script Valley