redisの存储方式

  • RDB存储

    rdis database存储方式,是将数据存储在一个xxx.rdb的文件中。文件中保存的数据就是redis中的内存数据。默认的存储方式,效率高,对磁盘的访问比较合理,对内存数据的监控也是有一定临界值的,保证数据尽可能不丢失。redis.conf

#   In the example below the behaviour will be to save:
#   after 900 sec (15 min) if at least 1 key changed
#   after 300 sec (5 min) if at least 10 keys changed
#   after 60 sec if at least 10000 keys changed
#   Note: you can disable saving completely by commenting out all "save" lines.
#   It is also possible to remove all the previously configured save
#   points by adding a save directive with a single empty string argument
#   like in the following example:
#   save ""
# 持久数据的规则. RDB持久规则. 存储数据的文件由dbfilename参数决定
save 900 1
save 300 10
save 60 10000

# RDB持久数据的文件命名. 可以使用绝对路径配置,如果没有路径配置,在命令运行的相对位置开始寻址存在。
dbfilename dump.rdb
  • AOF存储

    append of file 存储方式。对磁盘和IO的资源需求,比rdb方式高很多。对redis服务器的性能有很大的影响。Aof和rdb可以同时开启,但是,在redis重启的时候,会优先读取aof中保存的数据变化日志。不推荐同时启用,对磁盘的压力和IO的压力太高。推荐使用rdb。

# 是否启用append of file持久化方式.默认关闭.
# 每秒持久一次数据. 以追加的方式,持久到数据文件.
appendonly no

# aof持久方式的文件名称.
appendfilename "appendonly.aof"

猜你喜欢

转载自www.cnblogs.com/yangjiming/p/9581843.html