In the use of redis, sometimes need to modify the Redis configuration, such as in the case of business operations, memory is not enough to do, then either hurriedly delete useless memory, or expand memory. If there are useless content to delete then all the problems have been resolved. If the content is important, you can only select extended memory. When it comes to extended memory, Redis provides us with a command.
CONFIG SET
CONFIG SET parameter value
The Config SET command can dynamically adjust the configuration of the Redis server without restarting.
You can use it to modify configuration parameters or to change the way Redis is persisted (persistence).
Configuration parameters that can be modified by config set can be listed using Command config get * , and all configuration parameters modified by config set will take effect immediately.
For more information about the Config SET command, see instructions for command config GET.
For information on how to modify Redis persistence using the CONFIG SET command, see Redis persistence.
-
Available versions:
-
>= 2.0.0
-
Complexity of Time:
-
Not clear
-
return value:
Returns
- OK When the setting is successful, or an error is returned.
Example: adding memory dynamically
Redis127.0.0.1:6379>config get maxmemory1)"MaxMemory"2)"3221225472"Redis127.0.0.1:6379> Config set maxmemory4294967296Okredis127.0.0.1:6379>config get maxmemory1)"MaxMemory"2)"4294967296"
Let's see those parameters. Redis can be set dynamically
Redis127.0.0.1:6379> Config Get *1)"Dbfilename" 2)"Dump.rdb" 3)"Requirepass" 4)"" 5)"Masterauth" 6)"" 7)"Bind" 8)"" 9)"Unixsocket" Ten)"" One)"logfile" A)"" -)"Pidfile" -)"/usr/local/redis/var/run/redis.pid" the)"MaxMemory" -)"4294967296" -)"Maxmemory-samples" -)"3" +)"Timeout" -)"0" +)"tcp-keepalive" A)" -" at)"Auto-aof-rewrite-percentage" -)" -" -)"auto-aof-rewrite-min-size" -)"67108864" -)"hash-max-ziplist-entries" -)" +" in)"Hash-max-ziplist-value" -)" -" to)"list-max-ziplist-entries" +)" +" -)"List-max-ziplist-value" the)" -" *)"set-max-intset-entries" $)" +" Panax Notoginseng)"zset-max-ziplist-entries" -)" -" the)"Zset-max-ziplist-value" +)" -" A)"Lua-time-limit" the)" the" +)"Slowlog-log-slower-than" -)"10000" $)"Slowlog-max-len" $)" -" -)"Port" -)"6379" the)"databases" -)" +" Wuyi)"Repl-ping-slave-period" the)"Ten" -)"Repl-timeout" Wu)" -" -)"maxclients" About)"10000" $)"Watchdog-period" -)"0" -)"slave-priority" -)" -" A)"Hz" +)"Ten" the)"No-appendfsync-on-rewrite" -)"No" $)"Slave-serve-stale-data" the)"Yes" the)"slave-read-only" the)"Yes" the)"Stop-writes-on-bgsave-error" -)"Yes" in)"daemonize" the)"Yes" the)"rdbcompression" About)"Yes" the)"Rdbchecksum" the)"Yes" the)"activerehashing" +)"Yes" -)"Repl-disable-tcp-nodelay" the)"No" Bayi)"Aof-rewrite-incremental-fsync" the)"Yes" the)"appendonly" -)"No" -)"dir" the)"/usr/local/redis/db" the)"Maxmemory-policy" the)"Volatile-lru" the)"Appendfsync" -)"everysec" the)"Save" the)"1 10000" the)"loglevel" 94)"Notice" the)"Client-output-buffer-limit" the)"Normal 0 0 0 slave 268435456 67108864 pubsub 33554432 8388608" the)"Unixsocketperm" 98)"0" About)"slaveof"
How Redis dynamically adds memory, dynamically configured, without rebooting.