在 Redis 中,Redis 的根目录中有一个配置文件(redis.conf)。
通过 Redis CONFIG 命令获取和设置 Redis 配置。
1.获取所有配置:
127.0.0.1:6379>configget*
2.获取单个配置:
127.0.0.1:6379>configgetdbfilename
3.更新配置,可以直接编辑 redis.conf (redis.windows.conf)文件,也可以通过 CONFIG set 命令更新配置。
#set语法127.0.0.1:6379>configset配置名配置值端口不能set配置,要去配置文件中去修改,不然报错127.0.0.1:6379>configsetport6000(error) ERRUnsupportedCONFIGparameter: port
配置项:
port6379tcp-backlog511timeout0tcp-keepalive0loglevelnoticelogfile""databases16save9001save30010save6010000stop-writes-on-bgsave-erroryesrdbcompressionyesrdbchecksumyesdbfilenamedump.rdbdir ./slave-serve-stale-datayesslave-read-onlyyesrepl-diskless-syncnorepl-diskless-sync-delay5repl-disable-tcp-nodelaynoslave-priority100appendonlynoappendfilename"appendonly.aof"appendfsynceverysecno-appendfsync-on-rewritenoauto-aof-rewrite-percentage100auto-aof-rewrite-min-size64mbaof-load-truncatedyeslua-time-limit5000slowlog-log-slower-than10000slowlog-max-len128latency-monitor-threshold0notify-keyspace-events""hash-max-ziplist-entries512hash-max-ziplist-value64list-max-ziplist-entries512list-max-ziplist-value64set-max-intset-entries512zset-max-ziplist-entries128zset-max-ziplist-value64hll-sparse-max-bytes3000activerehashingyesclient-output-buffer-limitnormal000client-output-buffer-limitslave256mb64mb60client-output-buffer-limitpubsub32mb8mb60hz10aof-rewrite-incremental-fsyncyes
总结:
redis配置,其实就是对配置文件的一个修改,打开配置文件有很多的英文注释来说明每个是干嘛的,随用随查啊。
END