Bird
Raised Fist0
Redisquery~10 mins

Cluster creation in Redis - Interactive Code Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to create a Redis cluster with 3 nodes.

Redis
redis-cli --cluster create [1]
Drag options to blanks, or click blank then click option'
A127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 --cluster-replicas 0
B127.0.0.1:6379 127.0.0.1:6380 127.0.0.1:6381
C127.0.0.1:7000 127.0.0.1:7001
Dlocalhost:7000 localhost:7001 localhost:7002
Attempts:
3 left
💡 Hint
Common Mistakes
Using default Redis ports (6379) which are not cluster nodes.
Omitting the --cluster-replicas option.
Providing fewer than 3 nodes.
2fill in blank
medium

Complete the command to add a node to an existing Redis cluster.

Redis
redis-cli --cluster add-node [1] 127.0.0.1:7000
Drag options to blanks, or click blank then click option'
A127.0.0.1:7001
B127.0.0.1:6380
C127.0.0.1:7002
Dlocalhost:7003
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-cluster ports like 6380.
Using localhost instead of IP:port format.
Adding a node that is already part of the cluster.
3fill in blank
hard

Fix the error in the command to create a cluster with replicas.

Redis
redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 [1] 1
Drag options to blanks, or click blank then click option'
A--cluster-replicas-count
B--cluster-replica
C--replicas
D--cluster-replicas
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect option names like --cluster-replica or --replicas.
Omitting the option entirely.
Using a wrong number format.
4fill in blank
hard

Fill both blanks to specify the cluster creation with 3 nodes and 1 replica each.

Redis
redis-cli --cluster create [1] --cluster-replicas [2]
Drag options to blanks, or click blank then click option'
A127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005
B127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002
C1
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Listing only 3 nodes when replicas are specified.
Setting replicas to 3 instead of 1.
Using wrong IP:port formats.
5fill in blank
hard

Fill all three blanks to create a cluster with 3 masters, 3 replicas, and assign replicas correctly.

Redis
redis-cli --cluster create [1] --cluster-replicas [2] --cluster-assign-replicas [3]
Drag options to blanks, or click blank then click option'
A127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005
B1
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting some nodes.
Setting replicas to 0 or more than 1.
Using 'false' for replica assignment.

Practice

(1/5)
1. What is the main purpose of creating a Redis cluster?
easy
A. To spread data across multiple servers for better safety and speed
B. To store data only on a single server for simplicity
C. To backup data manually using external tools
D. To increase the size of a single Redis instance

Solution

  1. Step 1: Understand Redis cluster purpose

    Redis cluster is designed to distribute data across multiple servers to improve availability and performance.
  2. Step 2: Compare options

    Only To spread data across multiple servers for better safety and speed correctly describes spreading data for safety and speed; others are incorrect or unrelated.
  3. Final Answer:

    To spread data across multiple servers for better safety and speed -> Option A
  4. Quick Check:

    Redis cluster = data spread for safety and speed [OK]
Hint: Redis cluster means data spread across servers [OK]
Common Mistakes:
  • Thinking cluster stores data on one server only
  • Confusing cluster with manual backup
  • Assuming cluster only increases instance size
2. Which of the following is the correct syntax to start creating a Redis cluster with 3 nodes using redis-cli?
easy
A. redis-cli --create cluster 7000 7001 7002
B. redis-cli create cluster 192.168.1.1 192.168.1.2 192.168.1.3
C. redis-cli --cluster create 192.168.1.1:7000 192.168.1.2:7000 192.168.1.3:7000
D. redis-cli cluster start 192.168.1.1:7000 192.168.1.2:7000 192.168.1.3:7000

Solution

  1. Step 1: Recall Redis cluster creation command

    The correct command uses 'redis-cli --cluster create' followed by node addresses with ports.
  2. Step 2: Match options with correct syntax

    redis-cli --cluster create 192.168.1.1:7000 192.168.1.2:7000 192.168.1.3:7000 matches the correct syntax; others use wrong keywords or formats.
  3. Final Answer:

    redis-cli --cluster create 192.168.1.1:7000 192.168.1.2:7000 192.168.1.3:7000 -> Option C
  4. Quick Check:

    Correct syntax = redis-cli --cluster create + nodes [OK]
Hint: Use --cluster create with full node addresses [OK]
Common Mistakes:
  • Omitting --cluster flag
  • Using 'create cluster' instead of '--cluster create'
  • Not specifying ports with IPs
3. Given the command:
redis-cli --cluster create 10.0.0.1:7000 10.0.0.2:7000 10.0.0.3:7000 --cluster-replicas 1
What will be the effect of the --cluster-replicas 1 option?
medium
A. No replicas will be created; all nodes are masters
B. Each master node will have one replica node for backup
C. Replicas will be created but only for half the nodes
D. Replicas will be created only if manually assigned later

Solution

  1. Step 1: Understand --cluster-replicas option

    This option sets how many replica nodes each master will have in the cluster.
  2. Step 2: Interpret the value 1

    Setting it to 1 means each master node gets exactly one replica node for redundancy.
  3. Final Answer:

    Each master node will have one replica node for backup -> Option B
  4. Quick Check:

    --cluster-replicas 1 = one replica per master [OK]
Hint: Replicas number sets backups per master node [OK]
Common Mistakes:
  • Thinking replicas are optional or manual
  • Assuming no replicas with --cluster-replicas 1
  • Confusing replicas with number of masters
4. You run the command:
redis-cli --cluster create 192.168.0.1:7000 192.168.0.2:7000 --cluster-replicas 1
and get an error. What is the most likely cause?
medium
A. You must specify the password for each node
B. The IP addresses are invalid for cluster creation
C. The --cluster-replicas option cannot be used with only two nodes
D. You need at least 3 master nodes to create a cluster with replicas

Solution

  1. Step 1: Recall cluster node requirements

    Redis cluster requires at least 3 master nodes to function properly.
  2. Step 2: Analyze given nodes and replicas

    With only 2 nodes and replicas set to 1, there aren't enough masters to assign replicas.
  3. Final Answer:

    You need at least 3 master nodes to create a cluster with replicas -> Option D
  4. Quick Check:

    Minimum 3 masters needed for replicas [OK]
Hint: Minimum 3 masters needed for replicas [OK]
Common Mistakes:
  • Trying to create cluster with too few nodes
  • Assuming IP format causes error
  • Forgetting replicas need masters
5. You want to create a Redis cluster with 6 nodes: 3 masters and 3 replicas. Which command correctly achieves this?
hard
A. redis-cli --cluster create 10.1.1.1:7000 10.1.1.2:7000 10.1.1.3:7000 10.1.1.4:7000 10.1.1.5:7000 10.1.1.6:7000 --cluster-replicas 1
B. redis-cli --cluster create 10.1.1.1:7000 10.1.1.2:7000 10.1.1.3:7000 --cluster-replicas 3
C. redis-cli --cluster create 10.1.1.1:7000 10.1.1.2:7000 10.1.1.3:7000 10.1.1.4:7000 10.1.1.5:7000 10.1.1.6:7000 --cluster-replicas 3
D. redis-cli --cluster create 10.1.1.1:7000 10.1.1.2:7000 10.1.1.3:7000 10.1.1.4:7000 10.1.1.5:7000 10.1.1.6:7000

Solution

  1. Step 1: Understand cluster replicas option

    --cluster-replicas 1 means each master has one replica, so 3 masters + 3 replicas = 6 nodes total.
  2. Step 2: Check command correctness

    redis-cli --cluster create 10.1.1.1:7000 10.1.1.2:7000 10.1.1.3:7000 10.1.1.4:7000 10.1.1.5:7000 10.1.1.6:7000 --cluster-replicas 1 lists 6 nodes and sets replicas to 1, matching the requirement. redis-cli --cluster create 10.1.1.1:7000 10.1.1.2:7000 10.1.1.3:7000 --cluster-replicas 3 has too few nodes. redis-cli --cluster create 10.1.1.1:7000 10.1.1.2:7000 10.1.1.3:7000 10.1.1.4:7000 10.1.1.5:7000 10.1.1.6:7000 --cluster-replicas 3 sets replicas to 3, which is invalid for 3 masters. redis-cli --cluster create 10.1.1.1:7000 10.1.1.2:7000 10.1.1.3:7000 10.1.1.4:7000 10.1.1.5:7000 10.1.1.6:7000 lacks replicas setting.
  3. Final Answer:

    redis-cli --cluster create 10.1.1.1:7000 10.1.1.2:7000 10.1.1.3:7000 10.1.1.4:7000 10.1.1.5:7000 10.1.1.6:7000 --cluster-replicas 1 -> Option A
  4. Quick Check:

    6 nodes with --cluster-replicas 1 = 3 masters + 3 replicas [OK]
Hint: Replicas 1 means one replica per master [OK]
Common Mistakes:
  • Setting replicas higher than number of masters
  • Not listing all nodes in command
  • Omitting --cluster-replicas option
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