What is the purpose of the Redis configuration file?
The Redis configuration file sets up how the Redis server behaves, including settings like network ports, memory limits, and security options.
Click to reveal answer
beginner
Which directive in the Redis configuration file sets the port Redis listens on?
The port directive sets the TCP port number Redis listens on for client connections.
Click to reveal answer
intermediate
How do you enable password authentication in Redis using the configuration file?
Set the requirepass directive to your chosen password to require clients to authenticate.
Click to reveal answer
intermediate
What does the maxmemory setting control in the Redis configuration file?
It limits the maximum amount of memory Redis can use before it starts evicting data or returning errors.
Click to reveal answer
intermediate
How can you make Redis save data to disk periodically using the configuration file?
Use the save directives to specify time and change thresholds for automatic snapshots.
Click to reveal answer
Which directive sets the port Redis listens on?
Amaxmemory
Bport
Crequirepass
Dbind
✗ Incorrect
The port directive defines the TCP port Redis listens on.
How do you require clients to authenticate with a password?
Aauthpass
Bset password
Crequirepass
Dpassword_required
✗ Incorrect
The requirepass directive sets the password clients must provide.
What does the maxmemory setting do?
ALimits RAM usage
BLimits disk space used
CLimits CPU usage
DLimits number of clients
✗ Incorrect
maxmemory limits the RAM Redis can use.
Which directive controls how often Redis saves data to disk?
Asave
Bpersist
Csnapshot
Dbackup
✗ Incorrect
The save directive sets snapshot intervals.
What does the bind directive do?
ALimits memory usage
BSets the port number
CEnables password authentication
DSets the IP addresses Redis listens on
✗ Incorrect
bind restricts Redis to listen on specified IP addresses.
Explain the key settings you would configure in a Redis configuration file to secure and optimize your Redis server.
Think about network access, authentication, memory limits, and data persistence.
You got /5 concepts.
Describe how Redis uses the configuration file to manage data persistence and memory usage.
Consider how Redis saves data and controls memory limits.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of the Redis configuration file?
easy
A. To write Redis commands
B. To store user data permanently
C. To display Redis logs
D. To control how Redis runs and behaves
Solution
Step 1: Understand the role of configuration files
Configuration files set options that control how software behaves.
Step 2: Apply this to Redis
The Redis configuration file sets how Redis runs, including memory use and security.
Final Answer:
To control how Redis runs and behaves -> Option D
Quick Check:
Redis config file = controls Redis behavior [OK]
Hint: Config files set behavior, not data or commands [OK]
Common Mistakes:
Thinking config stores data
Confusing config with command input
Assuming config shows logs
2. Which line is the correct syntax to set the Redis port to 6380 in the configuration file?
easy
A. set port=6380
B. port 6380
C. port: 6380
D. port=6380
Solution
Step 1: Recall Redis config syntax
Redis config uses simple lines: setting_name followed by value, separated by space.
Step 2: Check each option
port 6380 matches this syntax: 'port 6380'. Others use invalid symbols or keywords.
Final Answer:
port 6380 -> Option B
Quick Check:
Redis config syntax = setting value [OK]
Hint: Use space between setting and value, no equals or colons [OK]
Common Mistakes:
Using '=' instead of space
Adding 'set' keyword
Using colon ':' instead of space
3. Given this Redis config snippet:
save 900 1
save 300 10
save 60 10000
port 6379
maxmemory 256mb
What does the save 300 10 line mean?
medium
A. Save the DB if at least 10 keys changed in 300 seconds
B. Save the DB every 300 seconds regardless of changes
C. Save the DB if 300 keys changed in 10 seconds
D. Save the DB only once after 300 seconds
Solution
Step 1: Understand Redis save syntax
The 'save' command uses two numbers: seconds and number of changes to trigger saving.
Step 2: Interpret 'save 300 10'
This means: if 10 or more keys changed in 300 seconds, Redis saves the DB.
Final Answer:
Save the DB if at least 10 keys changed in 300 seconds -> Option A
Quick Check:
save seconds changes = save if changes in seconds [OK]
Hint: First number = seconds, second = changes to trigger save [OK]
Common Mistakes:
Mixing order of seconds and changes
Thinking save triggers every fixed time
Ignoring the number of changes
4. You added this line to your Redis config file: maxmemory 512mb But Redis still uses more memory than 512MB. What is the likely problem?
medium
A. Redis needs to be restarted to apply config changes
B. The maxmemory setting requires a unit in uppercase (MB), not lowercase
C. maxmemory only limits disk usage, not RAM
D. The config file must have 'set maxmemory 512mb'
Solution
Step 1: Check Redis config behavior
Redis reads config file only at startup or when reloaded.
Step 2: Understand applying changes
Changing config file alone does not affect running Redis until restart or reload.
Final Answer:
Redis needs to be restarted to apply config changes -> Option A
Quick Check:
Config changes require restart or reload [OK]
Hint: Restart Redis after config edits to apply changes [OK]
Common Mistakes:
Assuming lowercase units are invalid
Thinking maxmemory limits disk space
Using 'set' keyword in config file
5. You want Redis to save data only if at least 5 keys change within 600 seconds, and limit memory to 1GB. Which two lines should you add to the config file?
hard
A. save 600 5
maxmemory 1mb
B. save 5 600
maxmemory 1024mb
C. save 600 5
maxmemory 1024mb
D. save 5 600
maxmemory 1gb
Solution
Step 1: Write correct save syntax
Save syntax is 'save <seconds> <changes>', so 'save 600 5' means save if 5 keys change in 600 seconds.
Step 2: Write correct maxmemory value
For 1GB (1024MB), 'maxmemory 1024mb' is correct (A). C uses '1mb' (only 1MB, too small).
Step 3: Choose correct combined lines
save 600 5
maxmemory 1024mb uses correct save syntax and valid maxmemory value.
Final Answer:
save 600 5
maxmemory 1024mb -> Option C
Quick Check:
save seconds changes + maxmemory in mb or gb [OK]
Hint: Save uses seconds then changes; maxmemory accepts mb or gb [OK]
Common Mistakes:
Swapping seconds and changes in save
Using invalid memory units
Mixing order of lines
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.