Redis的快照功能
来源:互联网 发布:数据库不能附加 编辑:程序博客网 时间:2024/06/05 16:32
引言: Redis是基于内存的数据库,同时也提供了若干持久化的方案,允许用户把内存中的数据,写入本地文件系统,以备下次重启或者当机之后继续使用。本文将描述如何基于Redis来设置这些功能。
快照的设置
a. 设置Redis.conf配置文件
Redis快照写入的频率
save 900 1
save 300 10
save 60 10000
快照文件名称设置
dbfilename dump.rdb
快照目录色绘制
dir /opt/redis
停用aof, 由于aof的优先级高于快照,所以,将其设为off之后,才可以使用snapshot
appendonly no
b. 启动Redis Server
C. 运行redis-cli,操作若干数据,并保存
D. 查看dump数据文件
E. 重启Redis-Server之后,依然可以读到之前的数据
从上述的过程中,我们已经可以看到整个的快照的使用过程了。
附录是个实际的 redis.conf 例子
daemonize yes
pidfile "/var/run/redis.pid"
port 6379
tcp-backlog 511
timeout 300
tcp-keepalive 0
loglevel notice
logfile ""
databases 16
save 900 10
save 300 500
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename "dump.rdb"
dir "/letv/redisdb"
masterauth "test"
slave-serve-stale-data yes
slave-read-only yes
slave-priority 100
#slaveof 1.1.1.1 6379
requirepass "test"
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
maxmemory 3096000kb
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
# Generated by CONFIG REWRITE
- Redis的快照功能
- Redis的快照功能
- Redis的快照功能
- Redis的快照功能
- Redis的快照功能
- Redis的快照功能
- Redis的快照与AOF
- Redis的快照与AOF
- Redis的快照与AOF
- kvm的快照功能 (二、基于libvirt的快照)
- kvm的快照功能 (一、基于qcow2文件的快照)
- 验证redis的快照和AOF
- redis的rdb快照持久化
- redis的快照和集群部署
- Redis的RDB(快照)与AOF
- VMware Snapshot快照功能的优缺点分析
- xcode的重构 快照功能
- 如何实现web界面的快照功能
- vb.net 教程 3-4 窗体编程 公共控件9 ListView 2
- Pull解析XML时出现System.err: org.xmlpull.v1.XmlPullParserException: Expected a quoted string (position:DO
- 378. Kth Smallest Element in a Sorted Matrix
- 闭包
- C语言中数组名的理解
- Redis的快照功能
- Python25行代码人脸识别
- 类加载器
- padas 生成excel 增加sheet表
- fuzhuo-----Problem 1019 猫捉老鼠
- 03-JDBC学习手册:JDBC中几个重要接口和异常处理
- vector中的erase注意事项
- 观察者模式
- 深入理解盒子模型——CSS 盒模型Block box与Line box