Introduction to Redis INFO
Redis info command returns the statistics and information about the server on which we are working. This command provides information in a simple format and this information is a very simple format that computers can easily parse and it’s very easy to read for humans. Redis provides multiple commands to show the server information. Redis info command is useful while displaying information related to the redis database server.
Key Takeaways
- Redis info command is used to display all the information related to the database server. It contains mainly client and server parameters with the info command.
- We are using the redis info command in multiple ways. To execute the info command we need to login into the redis-cli.
What is Redis INFO?
At the time of executing the redis info command, we need to use different optional parameters. If we are not using any parameter with the info command, then it will return all the information related to the server. When using the server parameter with the info command, it will return all information about the redis server. It will provide parameter information that we use on the database server.
Redis provides multiple diagnostics tools by using its command line tool interface. To execute the info command we need to login redis server by using the redis-cli command. After executing this command, we execute redis info command by using redis-cli. Info command gives all the metrics of the redis server that are currently available in DB.
Syntax:
Below is the syntax of redis info as follows. We are using different types of parameters using the info command.
INFO parameter_name
The info command is used in the above syntax to display the metrics of the redis server. This command displays all of the parameters that we use with the redis database server. The parameter name defines the parameter that we are using with the redis command. It will display the specified information about that parameter. If we use the parameter name as replication, it will display all information about the replication.
Redis Server Info Command
Redis server info command is used to display all the information of the redis server. The below example shows how we can login to the redis server by using redis-cli as follows.
Command:
# redis-cli
Output:
After executing the redis-cli command in the below example we are executing the info command without using any parameter. It will retrieve all the parameters that are stored on the redis server as follows.
Command:
INFO
Output:
From the above example, we can see that when the info command is executed, it displays all server-related information. Basically, it will display client, replication, and other information related to the Redis database server.
In the below example, we are using CPU parameters with the info command. After using the CPU parameter we can see that it will display all the information of the redis database related to the CPU as follows. We can see that used CPU system information and other parameter information are as follows.
Command:
INFO CPU
Output:
In the below example, we are using the keyspace parameter with the info command. After using the keyspace parameter we can see that it will display all the information of the redis database related to the keyspace.
Command:
INFO KEYSPACE
Output:
In the below example, we are using the stats parameter with the info command. After using the stats parameter, we can see that it will display all the information of the redis database related to the stats as follows.
Command:
INFO STATS
Output:
In the below example, we are using the persistence parameter with the info command. After using the persistence parameter, we can see that it will display all the information of the redis database related to the persistence as follows.
Command:
INFO Persistence
Output:
Parameters
We are using different types of parameters at the time of executing the redis info command as follows.
- Server – This parameter in info command is used to display general information related to the server.
- Client – This parameter in info command is used to display the section of client connection.
- Memory – It will display memory-related information.
- Persistence – It will display the information related to AOF and RDB.
- Stats – It will display the information related to general stats.
- Replication – Display the information related to the master and slave servers.
- CPU – This parameter display info related to the CPU.
- Commandstats – Statistics related to the commands.
- Latencystats – It will define the percentile distribution of latency statistics.
- Cluster – It will define the redis cluster section.
- Modules – It will define the redis modules section.
- Keyspace – It will define redis database-related information.
- Errorstats – It will define redis error statistics.
- All – It will be used to display all the sections.
- Default – It will be used to display only default sections.
- Everything – It is used to display all the modules.
Server and Clients Section
Redis info command contains the server and client sections. The below example shows how we can retrieve the server section as follows.
Command:
INFO server
Output:
In the above example we can see that the server parameter is used to display the info as follows:
- Redis_version – Redis server version
- Redis_git_sha1 – GIT sha1 algorithm
- Redis_git_dirty – Dirty flag
- Redis_build_id – Build id of redis
- Redis_mode – Server mode of redis
- OS – Name of OS
- Arch_bits – OS architecture
- Multiplexisng_api – Loop mechanism
- Atomicvar_api – Redis atomicvar API
- Gcc_version – GCC compiler version
- Process ID – Server process ID
- Run_id – Random value
- TCP port – TCP listen port
- Uptime_in_seconds – Uptime of server in sec
- Uptime_in_days – Uptime of server in days
- Hz – Frequency setting of server
- Lru_clock – Management of LRU
- Shutdown_in_milliseconds – Present at the time of shutdown
The below example shows how we can retrieve the client section as follows. And the below example shows that it will retrieve all information related to the client.
Command:
INFO CLIENTS
Output:
In the above example, we can see that the above client parameter is used to display the info as follows.
- Connected_clients – Number of client connections.
- Cluster_connections – Number of sockets.
- Maxclients – Max connections of redis server.
- Client_recent_max_input_buffer – Max input buffer.
- Client_recent_max_output_buffer – Max output buffer.
- Blocked_clients – Number of blocked clients.
- Tracking_clients – Number of tracking clients.
- Clients_in_timeout_table – Number of timeout table clients.
Examples of Redis INFO
Given below are the examples mentioned:
Example #1
In the below example, we are using all parameters with the info command.
Command:
INFO all
Output:
Example #2
In the below example, we are using the default parameter with the info command.
Command:
INFO default
Output:
Example #3
In the below example, we are using everything parameter with the info command.
Command:
INFO everything
Output:
FAQs
Given below are the FAQs mentioned:
Q1. What is the use of redis info command?
Answer: Redis info command is used to display all the information related to the redis database server.
Q2. What is the use of replication parameter in info command?
Answer: Replication command is used to display all the information related to the replication. It also shows info of the master and slave servers.
Q3. What is the use of modules parameter in info command?
Answer: Modules parameter in the info command is used to display the modules related section.
Conclusion
At the time of executing the redis info command, we need to use different optional parameters. If we are not using any parameter with info command then it will return all the information related to the server. Redis info command returns the statistics and information about the server on which we are working.
Recommended Articles
This is a guide to Redis INFO. Here we discuss the introduction, redis server info command, server and clients section, and examples. You may also have a look at the following articles to learn more –