赞
踩
127.0.0.1:6379> save
OK
127.0.0.1:6379>
4428:M 02 Aug 2024 19:56:52.391 * Ready to accept connections tcp
4428:M 02 Aug 2024 19:57:51.494 * DB saved on disk
4428:M 02 Aug 2024 19:58:10.097 * DB saved on disk
127.0.0.1:6379> bgsave
Background saving started
127.0.0.1:6379>
4428:M 02 Aug 2024 19:59:22.611 * Background saving started by pid 4460
4460:C 02 Aug 2024 19:59:22.614 * DB saved on disk
4460:C 02 Aug 2024 19:59:22.615 * Fork CoW for RDB: current 2 MB, peak 2 MB, average 2 MB
4428:M 02 Aug 2024 19:59:22.650 * Background saving terminated with success
[root@CentOS7 ~]# ps -ef|grep redis
root 4428 3846 0 19:56 pts/2 00:00:00 redis-server *:6379
root 4499 4097 0 20:00 pts/4 00:00:00 grep --color=auto redis
[root@CentOS7 ~]# kill -9 4428
[root@CentOS7 ~]#
4428:M 02 Aug 2024 19:59:22.650 * Background saving terminated with success
已杀死
[root@CentOS7 ~]#
# save ""
#
# Unless specified otherwise, by default Redis will save the DB:
# * After 3600 seconds (an hour) if at least 1 change was performed
# * After 300 seconds (5 minutes) if at least 100 changes were performed
# * After 60 seconds if at least 10000 changes were performed
#
# You can set these explicitly by uncommenting the following line.
# 当3600秒有一次修改 300秒有100次修改 60 秒有10000修改
# save 3600 1 300 100 60 10000
REDIS0011ú redis-ver^E7.2.0ú
redis-bitsÀ@ú^EctimeÂ^Zʬfú^Hused-memÂÈ^Q^O^@ú^Haof-baseÀ^@þ^@û^A^@^@^Bk1^Bv2ÿ¦<84>MYÑ<85><8e>X
~
"dump.rdb" [noeol][已转换] 2L, 120C
[root@CentOS7 ~]# cat dump.rdb
REDIS0011 redis-ver7.2.0
# Snapshotting can be completely disabled with a single empty string argument
# as in following example:
#
save ""
#
# Unless specified otherwise, by default Redis will save the DB:
# * After 3600 seconds (an hour) if at least 1 change was performed
# * After 300 seconds (5 minutes) if at least 100 changes were performed
# * After 60 seconds if at least 10000 changes were performed
bgsave开始时会fork主进程得到子进程 子进程共享主进程的内存数据。完成fork后读取内存数据并写入RDB文件
fork采用copy-on-write
# 表示每执行一次写命令,立即记录到AOF文件
appendfsync always
# 写命令执行完先放入AOF缓冲区,然后表示每隔1秒将缓冲区数据写到AOF文件,是默认方案
appendfsync everysec
# 写命令执行完先放入AOF缓冲区,由操作系统决定何时将缓冲区内容写回磁盘
appendfsync no
# Please check https://redis.io/topics/persistence for more information.
appendonly yes
# The base name of the append only file.
#
# Redis 7 and newer use a set of append-only files to persist the dataset
# and changes applied to it. There are two basic types of files in use:
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
- slave节点请求增量同步
- master节点判断replid,发现不一致,拒绝增量同步
- master将完整内存数据生成RDB,发送RDB到slave
- slave清空本地数据,加载master的RDB
- master将RDB期间的命令记录在repl_baklog,并持续将log中的命令发送给slave
- slave执行接收到的命令,保持与master之间的同步
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。