zoukankan      html  css  js  c++  java
  • redis动态添加内存,动态配置,无需重启

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

    CONFIG SET
    
    CONFIG SET parameter value
    
    CONFIG SET 命令可以动态地调整 Redis 服务器的配置(configuration)而无须重启。
    
    你可以使用它修改配置参数,或者改变 Redis 的持久化(Persistence)方式。
    
    CONFIG SET 可以修改的配置参数可以使用命令 CONFIG GET * 来列出,所有被 CONFIG SET 修改的配置参数都会立即生效。
    
    关于 CONFIG SET 命令的更多消息,请参见命令 CONFIG GET 的说明。
    
    关于如何使用 CONFIG SET 命令修改 Redis 持久化方式,请参见 Redis Persistence 。
    可用版本:>= 2.0.0时间复杂度:不明确返回值:当设置成功时返回 OK ,否则返回一个错误。
    

      

    例如:动态添加内存

    redis 127.0.0.1:6379> config get maxmemory
    1) "maxmemory"
    2) "3221225472"
    redis 127.0.0.1:6379> config set maxmemory 4294967296
    OK
    redis 127.0.0.1:6379> config get maxmemory
    1) "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"
    

      

  • 相关阅读:
    Do You See Me? Ethical Considerations of the Homeless
    ELDER HOMELESSNESS WHY IS THIS AN ISSUE?
    Endoflife support is lacking for homeless people
    html内联框架
    html字体
    html块 div span
    html列表
    html表格
    SQL Server管理员专用连接的使用   作为一名DBA,经常会处理一些比较棘手的服务无响应问题,鉴于事态的严重性,多数DBA可能直接用“重启”大法,以便尽快的恢复生产环境的正常运转,但是多数情况
    如何配置最大工作线程数 (SQL Server Management Studio)
  • 原文地址:https://www.cnblogs.com/lvcisco/p/10309195.html
Copyright © 2011-2022 走看看