Databases 6 min read

The Most Complete Redis Configuration Guide with Illustrated Examples

This article provides a thorough walkthrough of Redis configuration, covering the location of the redis.conf file, how to list all settings with CONFIG GET *, modify parameters via CONFIG SET, and detailed explanations of common options such as bind address, port, timeout, log level, database count, daemonization, log file, client limits, memory limits, persistence settings, replication, and password protection, each illustrated with concrete command examples.

Architect Chen
Architect Chen
Architect Chen
The Most Complete Redis Configuration Guide with Illustrated Examples

Redis Overview

Redis (Remote Dictionary Server) is an open‑source, high‑performance in‑memory key‑value database that supports various data structures such as strings, hashes, lists, and sets. Typical use cases include caching, distributed locking, and rate‑limiting.

Configuration File

The main configuration file is redis.conf located in the Redis installation directory (on Windows it is redis.windows.conf).

Listing All Configuration Items

You can retrieve every configuration parameter with the command: CONFIG GET * The result is shown in the accompanying screenshot.

Modifying Configuration

Settings can be changed either by editing redis.conf directly or by using the runtime command:

CONFIG SET <parameter> <newvalue>

Common Configuration Parameters

1. Bind address bind 127.0.1 2. Listening port port 6379 3. Client idle timeout (seconds) timeout 300 4. Log level (debug, verbose, notice, warning) loglevel notice 5. Number of databases databases 16 Clients select a database with SELECT <db-index>.

6. Run as daemon daemonize yes Set to no to run in the foreground.

7. Log file path logfile /usr/local/var/redis/redis.log 8. Maximum client connections maxclients 128 9. Maximum memory usage maxmemory <bytes> 10. Append‑only file (AOF) persistence appendonly no When enabled, the AOF file name defaults to appendonly.aof: appendfilename appendonly.aof 11. RDB compression rdbcompression yes Disabling saves CPU at the cost of larger dump files.

12. RDB file name dbfilename dump.rdb 13. Replication (slave configuration) slaveof <masterip> <masterport> When set, the instance synchronizes data from the specified master on startup.

14. AOF fsync policy

no – rely on OS cache (fast)

always – fsync after every write (slow, safe)

everysec – fsync once per second (default, balanced)

appendfsync everysec

Password Configuration

Via command CONFIG SET requirepass 123456 The new password takes effect immediately without a restart; clients must authenticate with AUTH 123456. This setting is temporary and resets after a server restart.

Via configuration file # requirepass 123456 Uncomment and set the password to make it permanent.

Summary

The guide enumerates essential Redis configuration options, demonstrates how to query and modify them both statically and at runtime, and explains the impact of each setting on security, performance, and persistence.

PerformanceRedisConfigurationsecurityCONFIGredis.conf
Architect Chen
Written by

Architect Chen

Sharing over a decade of architecture experience from Baidu, Alibaba, and Tencent.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.