Redis 配置

来源:互联网 发布:数据库可以存图片吗 编辑:程序博客网 时间:2024/06/06 17:18

在Redis中,在Redis的根目录下有一个配置文件(redis.conf)。当然您可以通过Redis CONFIG命令获取和设置所有的Redis配置。

语法:

以下是Redis中的CONFIG命令的基本语法。

redis 127.0.0.1:6379> CONFIG GET CONFIG_SETTING_NAME

示例:

redis 127.0.0.1:6379> CONFIG GET loglevel  1) "loglevel" 2) "notice"
PS:要获取所有配置设置,请使用 * 代替 CONFIG_SETTING_NAME

示例:

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

编辑配置

要更新配置,可以直接编辑redis.conf文件,也可以通过CONFIG set命令更新配置。

语法
以下是 CONFIG SET 命令的基本语法。



0 0