Bird
Raised Fist0
Redisquery~20 mins

Read-only replicas in Redis - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Redis Replica Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate
2:00remaining
What is the output of this Redis command on a read-only replica?
Consider a Redis read-only replica. What will be the result of running the command SET key1 value1 on this replica?
Redis
SET key1 value1
AError: command not found
BOK
Cnil
DREADONLY You can't write against a read only replica.
Attempts:
2 left
💡 Hint
Think about what a read-only replica is designed to do.
🧠 Conceptual
intermediate
1:30remaining
Why use read-only replicas in Redis?
Which of the following is the main reason to use read-only replicas in Redis?
ATo increase write throughput by distributing writes
BTo provide high availability and distribute read load
CTo encrypt data automatically
DTo store backup data that is never accessed
Attempts:
2 left
💡 Hint
Think about how replicas help with scaling and availability.
📝 Syntax
advanced
2:00remaining
Which command correctly configures a Redis instance as a read-only replica?
You want to configure a Redis server as a read-only replica of a master at IP 192.168.1.10 port 6379. Which command should you run on the replica?
AREPLICAOF 192.168.1.10 6379
BSLAVEOF 192.168.1.10 6379
CMASTEROF 192.168.1.10 6379
DFOLLOW 192.168.1.10 6379
Attempts:
2 left
💡 Hint
The newer Redis versions use a different keyword than SLAVEOF.
❓ optimization
advanced
2:00remaining
How to optimize read performance using Redis replicas?
You have a Redis master and multiple read-only replicas. Which approach best optimizes read performance for many clients?
ASend all read and write requests to the master only
BSend all requests to a single replica to reduce network hops
CDistribute read requests evenly among replicas, write requests to master
DDisable replicas and use only the master for all operations
Attempts:
2 left
💡 Hint
Think about load balancing reads and writes.
🔧 Debug
expert
3:00remaining
Why does this Redis replica not replicate writes from master?
A Redis replica is configured with REPLICAOF 10.0.0.1 6379. However, writes made on the master do not appear on the replica. What is the most likely cause?
ANetwork connectivity issues prevent replication
BThe master has disabled replication with the replica
CThe replica is in read-only mode and cannot replicate writes
DThe replica was started with the --slave-read-only no option
Attempts:
2 left
💡 Hint
Replication requires network communication between master and replica.

Practice

(1/5)
1. What is the main purpose of a read-only replica in Redis?
easy
A. To handle write requests and update the master
B. To copy data from the master and handle read requests
C. To delete data from the master server
D. To act as a backup that does not sync data

Solution

  1. Step 1: Understand the role of read-only replicas

    Read-only replicas copy data from the master Redis server and serve read requests to reduce load on the master.
  2. Step 2: Identify the correct purpose

    They do not handle writes or delete data; their main job is to share read load.
  3. Final Answer:

    To copy data from the master and handle read requests -> Option B
  4. Quick Check:

    Read-only replicas = copy data + read requests [OK]
Hint: Replicas copy data and serve reads, not writes [OK]
Common Mistakes:
  • Thinking replicas handle writes
  • Believing replicas delete data
  • Assuming replicas do not sync data
2. Which Redis command is used to configure a server as a read-only replica of another?
easy
A. SETREPLICA <port>
B. COPYFROM <port>
C. SYNCREPLICA <port>
D. REPLICAOF <port>

Solution

  1. Step 1: Recall the correct Redis command for replication

    The command to set a Redis server as a replica is REPLICAOF followed by the master's IP and port.
  2. Step 2: Verify other options

    Other commands like SETREPLICA, COPYFROM, SYNCREPLICA do not exist in Redis.
  3. Final Answer:

    REPLICAOF <master-ip> <port> -> Option D
  4. Quick Check:

    Replica setup command = REPLICAOF [OK]
Hint: Use REPLICAOF to set or remove replication [OK]
Common Mistakes:
  • Using non-existent commands
  • Confusing REPLICAOF with SYNC commands
  • Misspelling the command name
3. Given a Redis replica configured with REPLICAOF 192.168.1.10 6379, what happens if you try to run SET key value on the replica?
medium
A. An error occurs because replicas are read-only
B. The key is set successfully on the replica
C. The command is forwarded to the master automatically
D. The replica disconnects from the master

Solution

  1. Step 1: Understand replica behavior on write commands

    Redis replicas are read-only and reject write commands like SET.
  2. Step 2: Identify the outcome of running SET on a replica

    Running SET on a replica causes an error because it cannot accept writes.
  3. Final Answer:

    An error occurs because replicas are read-only -> Option A
  4. Quick Check:

    Write commands on replicas = error [OK]
Hint: Replicas reject writes, only master accepts them [OK]
Common Mistakes:
  • Assuming writes succeed on replicas
  • Thinking commands auto-forward to master
  • Believing replica disconnects on write
4. You configured a Redis replica with REPLICAOF 192.168.1.10 6379 but it is not syncing data. What is the most likely cause?
medium
A. The replica command should be REPLICA instead of REPLICAOF
B. The replica server is running an older Redis version
C. The master IP or port is incorrect
D. The master server is set as a replica itself

Solution

  1. Step 1: Check configuration details

    If the replica is not syncing, the most common cause is incorrect master IP or port in the REPLICAOF command.
  2. Step 2: Evaluate other options

    Older Redis versions may cause issues but less likely; REPLICAOF is the correct command; master being a replica can cause sync issues but less common.
  3. Final Answer:

    The master IP or port is incorrect -> Option C
  4. Quick Check:

    Incorrect master address = no sync [OK]
Hint: Verify master IP and port carefully [OK]
Common Mistakes:
  • Using wrong command name
  • Ignoring IP/port typos
  • Assuming version mismatch is always cause
5. You want to temporarily stop replication on a Redis replica without shutting it down. Which command should you use?
hard
A. REPLICAOF NO ONE
B. REPLICAOF NONE
C. STOPREPLICA
D. DISABLEREPLICA

Solution

  1. Step 1: Recall how to remove replication

    To stop replication temporarily, use REPLICAOF NO ONE which makes the replica a standalone server.
  2. Step 2: Check other options

    Commands like REPLICAOF NONE, STOPREPLICA, DISABLEREPLICA do not exist in Redis.
  3. Final Answer:

    REPLICAOF NO ONE -> Option A
  4. Quick Check:

    Stop replication = REPLICAOF NO ONE [OK]
Hint: Use REPLICAOF NO ONE to stop replication temporarily [OK]
Common Mistakes:
  • Using incorrect command variants
  • Trying to shut down replica to stop replication
  • Confusing NO ONE with NONE
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard