Redis Configuration: Basic and advance

In Redis, there is a configuration file (redis.conf) handy at the root listing of Redis. Although you can get and set all Redis configurations by means of Redis CONFIG command.

Syntax

Following is the basic syntax of Redis CONFIG command.

redis 127.0.0.1:6379> CONFIG GET CONFIG_SETTING_NAME  

Example

redis 127.0.0.1:6379> CONFIG GET loglevel    

Output

“loglevel”

“notice”

To get all configuration settings, use * in region of CONFIG_SETTING_NAME

Example

redis 127.0.0.1:6379> CONFIG GET *    

Output

“dir” “C:\\Program Files\\Redis” “dbfilename” “dump.rdb” “requirepass” (nil) “masterauth” (nil) “maxmemory” “0” “maxmemory-policy” “volatile-lru” “maxmemory-samples” “3” “timeout” “0” “appendonly” “no” “no-appendfsync-on-rewrite” “no” “appendfsync” “everysec” “save” “3600 1 300 100 60 10000” “auto-aof-rewrite-percentage” “100” “auto-aof-rewrite-min-size” “1048576” “slave-serve-stale-data” “yes” “hash-max-zipmap-entries” “512” “hash-max-zipmap-value” “64” “list-max-ziplist-entries” “512” “list-max-ziplist-value” “64” “set-max-intset-entries” “512” “zset-max-ziplist-entries” “128” “zset-max-ziplist-value” “64” “slowlog-log-slower-than” “10000” “slowlog-max-len” “64” “loglevel” “verbose”

Edit Configuration

To update configuration, you can edit redis.conf file directly or you can update configurations with the aid of CONFIG set command.

Syntax

Following is the simple syntax of CONFIG SET command.

redis 127.0.0.1:6379> CONFIG SET CONFIG_SETTING_NAME NEW_CONFIG_VALUE  

Example

CONFIG GET "loglevel"  

Next TopicRedis Data Types