博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
redis怎么动态添加内存,动态配置,无需重启。
阅读量:4624 次
发布时间:2019-06-09

本文共 2463 字,大约阅读时间需要 8 分钟。

在redis的使用过程中,有时候需要急需修改redis的配置,比如在业务运行的情况下,内存不够怎么办,这时要么赶紧删除无用的内存,要么扩展内存。如果有无用的内容可删除那么所有问题都已经解决。如果内容都是重要的,那只能选择扩展内存。说到扩展内存,redis为我们提供了一个命令。

CONFIG SET

CONFIG SET parameter value

 命令可以动态地调整 Redis 服务器的配置(configuration)而无须重启。

你可以使用它修改配置参数,或者改变 Redis 的持久化(Persistence)方式。

 可以修改的配置参数可以使用命令 CONFIG GET * 来列出,所有被  修改的配置参数都会立即生效。

关于  命令的更多消息,请参见命令  的说明。

关于如何使用  命令修改 Redis 持久化方式,请参见  。

可用版本:
>= 2.0.0
时间复杂度:
不明确
返回值:
当设置成功时返回 
OK ,否则返回一个错误。

例如:动态添加内存

redis 127.0.0.1:6379> config get maxmemory1) "maxmemory"2) "3221225472"redis 127.0.0.1:6379> config set maxmemory 4294967296OKredis 127.0.0.1:6379> config get maxmemory1) "maxmemory"2) "4294967296"

 

我们看看那些参数 redis可以动态设置

redis 127.0.0.1:6379> config get *  1) "dbfilename"  2) "dump.rdb"  3) "requirepass"  4) ""  5) "masterauth"  6) ""  7) "bind"  8) ""  9) "unixsocket" 10) "" 11) "logfile" 12) "" 13) "pidfile" 14) "/usr/local/redis/var/run/redis.pid" 15) "maxmemory" 16) "4294967296" 17) "maxmemory-samples" 18) "3" 19) "timeout" 20) "0" 21) "tcp-keepalive" 22) "60" 23) "auto-aof-rewrite-percentage" 24) "100" 25) "auto-aof-rewrite-min-size" 26) "67108864" 27) "hash-max-ziplist-entries" 28) "512" 29) "hash-max-ziplist-value" 30) "64" 31) "list-max-ziplist-entries" 32) "512" 33) "list-max-ziplist-value" 34) "64" 35) "set-max-intset-entries" 36) "512" 37) "zset-max-ziplist-entries" 38) "128" 39) "zset-max-ziplist-value" 40) "64" 41) "lua-time-limit" 42) "5000" 43) "slowlog-log-slower-than" 44) "10000" 45) "slowlog-max-len" 46) "128" 47) "port" 48) "6379" 49) "databases" 50) "32" 51) "repl-ping-slave-period" 52) "10" 53) "repl-timeout" 54) "60" 55) "maxclients" 56) "10000" 57) "watchdog-period" 58) "0" 59) "slave-priority" 60) "100" 61) "hz" 62) "10" 63) "no-appendfsync-on-rewrite" 64) "no" 65) "slave-serve-stale-data" 66) "yes" 67) "slave-read-only" 68) "yes" 69) "stop-writes-on-bgsave-error" 70) "yes" 71) "daemonize" 72) "yes" 73) "rdbcompression" 74) "yes" 75) "rdbchecksum" 76) "yes" 77) "activerehashing" 78) "yes" 79) "repl-disable-tcp-nodelay" 80) "no" 81) "aof-rewrite-incremental-fsync" 82) "yes" 83) "appendonly" 84) "no" 85) "dir" 86) "/usr/local/redis/db" 87) "maxmemory-policy" 88) "volatile-lru" 89) "appendfsync" 90) "everysec" 91) "save" 92) "900 1 300 10 60 10000" 93) "loglevel" 94) "notice" 95) "client-output-buffer-limit" 96) "normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 8388608 60" 97) "unixsocketperm" 98) "0" 99) "slaveof"

 

转载于:https://www.cnblogs.com/perry-monk/p/4232535.html

你可能感兴趣的文章
apicloud UISearchBar 使用方法
查看>>
【spring+websocket的使用】
查看>>
mongo二维数组操作
查看>>
localStorage之本地储存
查看>>
Archlinux 交换左Ctrl和Cap键
查看>>
#openstack故障处理汇总
查看>>
搜索旋转排序数组 II
查看>>
20、docker swarm
查看>>
psp工具软件前景与范围文档
查看>>
day06-三元表达式
查看>>
C# DateTime.Now详细用法
查看>>
Php中"{}"大括号的用法总结(转)
查看>>
JavaScript内存优化
查看>>
BZOJ1059: [ZJOI2007]矩阵游戏(二分图匹配)
查看>>
P3385 【模板】负环
查看>>
URI、URL 和 URN的区别
查看>>
根据表达式序列(前缀、中缀、后缀)构建表达式树
查看>>
mysql性能优化
查看>>
【SqlServer系列】语法定义符号解析
查看>>
Color Length UVA - 1625
查看>>