[フレーム]
Docs Pricing
Login Book a meeting Try Redis

INFO

Syntax
INFO [section [section ...]]
Available since:
Redis Open Source 1.0.0
Time complexity:
O(1)
ACL categories:
@slow, @dangerous,
Compatibility:
Redis Enterprise and Redis Cloud compatibility

The INFO command returns information and statistics about the server in a format that is simple to parse by computers and easy to read by humans.

The optional parameter can be used to select a specific section of information:

It can also take the following values:

When no parameter is provided, the default option is assumed.

INFO
Are you tired of using redis-cli? Try Redis Insight - the developer GUI for Redis.
import redis
r = redis.Redis(decode_responses=True)
res1 = r.flushall(asynchronous=False)
print(res1) # >>> True
res2 = r.keys()
print(res2) # >>> []
res3 = r.info()
print(res3)
# >>> {'redis_version': '7.4.0', 'redis_git_sha1': 'c9d29f6a',...}
Python Quick-Start
import { createClient } from 'redis';
const client = createClient();
await client.connect().catch(console.error);
const res1 = await client.flushAll('SYNC'); // or ASYNC
console.log(res1); // OK

const res2 = await client.keys('*');
console.log(res2); // []

const res3 = await client.info();
console.log(res3)
// # Server
// redis_version:7.4.0
// redis_git_sha1:c9d29f6a
// redis_git_dirty:0
// redis_build_id:4c367a16e3f9616
// redis_mode:standalone
// ...

await client.close();
Node.js Quick-Start
importjava.util.Set;importredis.clients.jedis.Jedis;importredis.clients.jedis.UnifiedJedis;import staticorg.junit.jupiter.api.Assertions.assertEquals;publicclass CmdsServerMgmtExample{publicvoidrun(){UnifiedJedisjedis=newUnifiedJedis("redis://localhost:6379");StringflushAllResult1=jedis.flushAll();System.out.println(flushAllResult1);// >>> OKSet<String>flushAllResult2=jedis.keys("*");System.out.println(flushAllResult2);// >>> []// Note: you must use the `Jedis` class to access the `info`// command rather than `UnifiedJedis`.Jedisjedis2=newJedis("redis://localhost:6379");StringinfoResult=jedis2.info();// Check the first 8 characters of the result (the full `info` string// is much longer than this).System.out.println(infoResult.substring(0,8));// >>> # Serverjedis2.close();jedis.close();}}
Java-Sync Quick-Start
package example_commands_test
import (
	"context"
	"fmt"
	"github.com/redis/go-redis/v9"
)
func ExampleClient_cmd_flushall() {
	ctx := context.Background()
	rdb := redis.NewClient(&redis.Options{
		Addr: "localhost:6379",
		Password: "", // no password docs
		DB: 0, // use default DB
	})
	flushAllResult1, err := rdb.FlushAll(ctx).Result()
	if err != nil {
		panic(err)
	}
	fmt.Println(flushAllResult1) // >>> OK
	flushAllResult2, err := rdb.Keys(ctx, "*").Result()
	if err != nil {
		panic(err)
	}
	fmt.Println(flushAllResult2) // >>> []
}
func ExampleClient_cmd_info() {
	ctx := context.Background()
	rdb := redis.NewClient(&redis.Options{
		Addr: "localhost:6379",
		Password: "", // no password docs
		DB: 0, // use default DB
	})
	infoResult, err := rdb.Info(ctx).Result()
	if err != nil {
		panic(err)
	}
	// Check the first 8 characters (the full info string contains
	// much more text than this).
	fmt.Println(infoResult[:8]) // >>> # Server
}
Go Quick-Start

Give these commands a try in the interactive console:

INFO

Notes

Please note depending on the version of Redis some of the fields have been added or removed. A robust client application should therefore parse the result of this command by skipping unknown properties, and gracefully handle missing fields.

Here is the description of fields for Redis >= 2.4.

Here is the meaning of all fields in the server section:

Here is the meaning of all fields in the clients section:

Here is the meaning of all fields in the memory section:

Ideally, the used_memory_rss value should be only slightly higher than used_memory. When rss >> used, a large difference may mean there is (external) memory fragmentation, which can be evaluated by checking allocator_frag_ratio, allocator_frag_bytes. When used >> rss, it means part of Redis memory has been swapped off by the operating system: expect some significant latencies.

Because Redis does not have control over how its allocations are mapped to memory pages, high used_memory_rss is often the result of a spike in memory usage.

When Redis frees memory, the memory is given back to the allocator, and the allocator may or may not give the memory back to the system. There may be a discrepancy between the used_memory value and memory consumption as reported by the operating system. It may be due to the fact memory has been used and released by Redis, but not given back to the system. The used_memory_peak value is generally useful to check this point.

Additional introspective information about the server's memory can be obtained by referring to the MEMORY STATS command and the MEMORY DOCTOR.

Here is the meaning of all fields in the persistence section:

rdb_changes_since_last_save refers to the number of operations that produced some kind of changes in the dataset since the last time either SAVE or BGSAVE was called.

If AOF is activated, these additional fields will be added:

If a load operation is on-going, these additional fields will be added:

The threads section provides statistics on I/O threads. The statistics are the number of assigned clients, the number of read events processed, and the number of write events processed. Added in Redis 8.0.

For each I/O thread, the following line is added:

Here is the meaning of all fields in the stats section:

Here is the meaning of all fields in the replication section:

If the instance is a replica, these additional fields are provided:

If a SYNC operation is on-going, these additional fields are provided:

If the link between master and replica is down, an additional field is provided:

The following field is always provided:

If the server is configured with the min-slaves-to-write (or starting with Redis 5 with the min-replicas-to-write) directive, an additional field is provided:

For each replica, the following line is added:

Here is the meaning of all fields in the cpu section:

The commandstats section provides statistics based on the command type, including the number of calls that reached command execution (not rejected), the total CPU time consumed by these commands, the average CPU consumed per command execution, the number of rejected calls (errors prior command execution), and the number of failed calls (errors within the command execution).

For each command type, the following line is added:

The latencystats section provides latency percentile distribution statistics based on the command type.

By default, the exported latency percentiles are the p50, p99, and p999. If you need to change the exported percentiles, use CONFIG SET latency-tracking-info-percentiles "50.0 99.0 99.9".

This section requires the extended latency monitoring feature to be enabled (by default it's enabled). If you need to enable it, use CONFIG SET latency-tracking yes.

For each command type, the following line is added:

The errorstats section enables keeping track of the different errors that occurred within Redis, based upon the reply error prefix ( The first word after the "-", up to the first space. Example: ERR ).

For each error type, the following line is added:

If the server detects that this section was flooded with an excessive number of errors, it will be disabled, show a single ERRORSTATS_DISABLED error, and print the errors to the server log. This can be reset by CONFIG RESETSTAT.

The sentinel section is only available in Redis Sentinel instances. It consists of the following fields:

The cluster section currently only contains a unique field:

The modules section contains additional information about loaded modules if the modules provide it. The field part of property lines in this section are always prefixed with the module's name.

Redis Query Engine fields

  1. Available in RediSearch 2.6.
  2. Available in RediSearch 2.8.
  3. Available in RediSearch 8.0.

The keyspace section provides statistics on the main dictionary of each database. The statistics are the number of keys, and the number of keys with an expiration.

For each database, the following line is added:

The keysizes section provides detailed statistics on the distribution of key sizes for each data type (strings, lists, sets, hashes, and sorted sets) within the dataset. The distribution is tracked using a base-2 logarithmic histogram.

Here's sample output from a two-database instance of Redis:

# Keysizes
db0_distrib_strings_sizes:2=1,4=1,8=1,16=1,32=1,64=1,128=1,256=1,512=1,1K=1,2K=1,4K=1,8K=1,16K=1,32K=1,64K=1,128K=1,256K=1,512K=1,1M=1
db0_distrib_lists_items:1=1,2=1,4=1,8=1,16=1,32=1,64=1,128=1,256=1,512=1,1K=1,2K=1,4K=1,8K=1,16K=1,32K=1,64K=1
db0_distrib_sets_items:1=1,2=1,4=1,8=1,16=1,32=1,64=1,128=1,256=1,512=1,1K=1,2K=1,4K=1,8K=1,16K=1,32K=1,64K=1
db0_distrib_zsets_items:1=1,2=1,4=1,8=1,16=1,32=1,64=1,128=1,256=1,512=1,1K=1,2K=1,4K=1,8K=1,16K=1,32K=1,64K=1
db0_distrib_hashes_items:1=1,2=1,4=1,8=1,16=1,32=1,64=1,128=1,256=1,512=1,1K=1,2K=1,4K=1,8K=1,16K=1,32K=1
db1_distrib_strings_sizes:2=1,4=1,8=1,16=1,32=1,64=1,128=1,256=1,512=1,1K=1,2K=1,4K=1,8K=1,16K=1,32K=1,64K=1,128K=1,256K=1,512K=1,1M=1
db1_distrib_lists_items:1=1,2=1,4=1,8=1,16=1,32=1,64=1,128=1,256=1,512=1,1K=1,2K=1,4K=1,8K=1,16K=1,32K=1,64K=1
db1_distrib_sets_items:1=1,2=1,4=1,8=1,16=1,32=1,64=1,128=1,256=1,512=1,1K=1,2K=1,4K=1,8K=1,16K=1,32K=1,64K=1
db1_distrib_zsets_items:1=1,2=1,4=1,8=1,16=1,32=1,64=1,128=1,256=1,512=1,1K=1,2K=1,4K=1,8K=1,16K=1,32K=1,64K=1
db1_distrib_hashes_items:1=1,2=1,4=1,8=1,16=1,32=1,64=1,128=1,256=1,512=1,1K=1,2K=1,4K=1,8K=1,16K=1,32K=1

The debug section contains experimental metrics, which might change or get removed in future versions. It won't be included when INFO or INFO ALL are called, and it is returned only when INFO DEBUG is used.

A note about the word slave used in this man page: Starting with Redis 5, if not for backward compatibility, the Redis project no longer uses the word slave. Unfortunately in this command the word slave is part of the protocol, so we'll be able to remove such occurrences only when this API will be naturally deprecated.

Modules generated sections: Starting with Redis 6, modules can inject their information into the INFO command. These are excluded by default even when the all argument is provided (it will include a list of loaded modules but not their generated info fields). To get these you must use either the modules argument or everything.

Redis Enterprise and Redis Cloud compatibility

Redis
Enterprise
Redis
Cloud
Notes
✅ Standard
✅ Active-Active
✅ Standard
✅ Active-Active
In Redis Enterprise, INFO returns a different set of fields than Redis Open Source.
Not supported for scripts.

Note: key memory usage is different on Redis Software or Redis Cloud active-active databases than on non-active-active databases. This is because memory usage includes some amount of CRDB overhead.

Additionally, for JSON keys, Redis implements a "shared string" mechanism to save memory when the same JSON field names or field values of type string are used more than once (either inter-key or intra-key). In such cases, instead of storing the field names or values many times, Redis stores them only once. This mechanism is not in place for active-active databases.

On non-active-active databases, INFO (Memory > used_memory) reports that the shared memory is counted, but only once for all keys. On active-active databases, there is no shared memory, so if strings are repeated, they are stored multiple times.

Example

Suppose you have ten JSON keys, and each key has 5KB of unique content and 5KB of shared content.

For non-active-active databases, INFO (used_memory) would report (10 keys * 5KB) + 5KB ~= 55KB. The last term, "+ 5KB", is the size of the shared content.

For active-active databases, INFO (used_memory) would report 10 keys * 20KB ~= 200KB. This number includes some amount of CRDB overhead per JSON key.

Return information

Bulk string reply: a map of info fields, one field per line in the form of <field>:<value> where the value can be a comma separated map like <key>=<val>. Also contains section header lines starting with # and blank lines. Lines can contain a section name (starting with a # character) or a property. All the properties are in the form of field:value terminated by \r\n.

History

RATE THIS PAGE
Back to top ↑

AltStyle によって変換されたページ (->オリジナル) /