📖 Scenario: You are managing a Redis server that stores data for a web application. To keep the server healthy and running smoothly, you want to check its status and performance regularly.
🎯 Goal: Learn how to use the Redis INFO command to monitor server statistics like memory usage, connected clients, and uptime.
📋 What You'll Learn
Connect to the Redis server using the Redis CLI
Use the INFO command to get server information
Extract specific sections of the INFO output
Display key server metrics clearly
💡 Why This Matters
🌍 Real World
Monitoring Redis server health helps prevent downtime and performance issues in real web applications.
💼 Career
Knowing how to use Redis INFO command is essential for DevOps engineers and system administrators managing Redis databases.
Progress0 / 4 steps
1
Connect to Redis Server
Open your terminal and connect to the Redis server by typing redis-cli and pressing Enter.
Redis
Hint
Use the command redis-cli to start the Redis command line interface.
2
Run INFO Command to Get All Server Information
In the Redis CLI, type INFO and press Enter to get all server information.
Redis
Hint
The INFO command shows detailed information about the Redis server.
3
Get Memory Section Only
In the Redis CLI, type INFO memory and press Enter to see only memory-related statistics.
Redis
Hint
Use INFO memory to focus on memory usage details.
4
Display Key Metrics: Used Memory and Connected Clients
In the Redis CLI, type INFO and then use grep or look manually to find and display the lines starting with used_memory: and connected_clients:.
Redis
Hint
Use grep -E 'used_memory:|connected_clients:' to filter the INFO output for these metrics.
Practice
(1/5)
1. What does the Redis INFO command primarily provide?
easy
A. A snapshot of the Redis server status and statistics
B. A list of all keys stored in Redis
C. The configuration file contents
D. A backup of the Redis database
Solution
Step 1: Understand the purpose of INFO command
The INFO command is designed to give a snapshot of the Redis server's current status and statistics.
Step 2: Compare with other options
Listing keys, showing config files, or backups are done by other commands, not INFO.
Final Answer:
A snapshot of the Redis server status and statistics -> Option A
Quick Check:
INFO = Server status snapshot [OK]
Hint: INFO shows server stats, not keys or configs [OK]
Common Mistakes:
Confusing INFO with commands like KEYS or CONFIG
Thinking INFO returns data backups
Assuming INFO lists all stored keys
2. Which of the following is the correct syntax to get only the memory section info from Redis?
easy
A. INFO --section=memory
B. INFO -memory
C. GET INFO memory
D. INFO memory
Solution
Step 1: Recall Redis INFO command syntax
The correct syntax to get a specific section is INFO section_name, for example, INFO memory.
Step 2: Eliminate incorrect options
Options with dashes or GET keyword are invalid Redis command syntax.
Final Answer:
INFO memory -> Option D
Quick Check:
INFO section_name = INFO memory [OK]
Hint: Use INFO followed by section name without dashes [OK]