当前位置:网站首页>RDB持久化验证测试
RDB持久化验证测试
2022-06-26 09:41:00 【xianghan收藏册】
RDB持久化验证测试
验证shutdown的持久化
1.正例
如果已经存在rdb文件先删除
rm -rf dump.rdb
保存测试值
set k1 1
set k2 2
执行shutdown,验证保存rdb文件
127.0.0.1:6379> SHUTDOWN
not connected> exit
查看文件
[[email protected] redis-3.2.9]# ll
total 20344
-rw-rw-r--. 1 root root 87407 May 17 2017 00-RELEASENOTES
-rw-rw-r--. 1 root root 53 May 17 2017 BUGS
-rw-rw-r--. 1 root root 1805 May 17 2017 CONTRIBUTING
-rw-rw-r--. 1 root root 1487 May 17 2017 COPYING
drwxrwxr-x. 7 root root 4096 Jan 22 17:54 deps
-rw-r--r--. 1 root root 93 Jan 25 16:59 dump.rdb
-rw-rw-r--. 1 root root 11 May 17 2017 INSTALL
-rw-rw-r--. 1 root root 151 May 17 2017 Makefile
-rw-rw-r--. 1 root root 4223 May 17 2017 MANIFESTO
-rw-rw-r--. 1 root root 6834 May 17 2017 README.md
-rwxr-xr-x. 1 root root 2433664 Jan 22 18:09 redis-benchmark
-rwxr-xr-x. 1 root root 25165 Jan 22 18:09 redis-check-aof
-rwxr-xr-x. 1 root root 5183694 Jan 22 18:09 redis-check-rdb
-rwxr-xr-x. 1 root root 2586683 Jan 22 18:09 redis-cli
-rw-rw-r--. 1 root root 46696 Jan 22 18:10 redis.conf
-rwxr-xr-x. 1 root root 5183694 Jan 22 18:09 redis-sentinel
-rwxr-xr-x. 1 root root 5183694 Jan 22 18:09 redis-server
-rwxrwxr-x. 1 root root 271 May 17 2017 runtest
-rwxrwxr-x. 1 root root 280 May 17 2017 runtest-cluster
-rwxrwxr-x. 1 root root 281 May 17 2017 runtest-sentinel
-rw-rw-r--. 1 root root 7606 May 17 2017 sentinel.conf
drwxrwxr-x. 2 root root 4096 Jan 22 18:05 src
drwxrwxr-x. 10 root root 4096 May 17 2017 tests
drwxrwxr-x. 7 root root 4096 May 17 2017 utils
恢复运行
./redis-server redis.conf
验证
127.0.0.1:6379> get k1
"1"
数据恢复成功
2.反例
保存测试值
set k1 1
set k2 2
执行shutdown,验证保存rdb文件
127.0.0.1:6379> SHUTDOWN
not connected> exit
查看文件
[[email protected] redis-3.2.9]# ll
total 20344
-rw-rw-r--. 1 root root 87407 May 17 2017 00-RELEASENOTES
-rw-rw-r--. 1 root root 53 May 17 2017 BUGS
-rw-rw-r--. 1 root root 1805 May 17 2017 CONTRIBUTING
-rw-rw-r--. 1 root root 1487 May 17 2017 COPYING
drwxrwxr-x. 7 root root 4096 Jan 22 17:54 deps
-rw-r--r--. 1 root root 93 Jan 25 16:59 dump.rdb
-rw-rw-r--. 1 root root 11 May 17 2017 INSTALL
-rw-rw-r--. 1 root root 151 May 17 2017 Makefile
-rw-rw-r--. 1 root root 4223 May 17 2017 MANIFESTO
-rw-rw-r--. 1 root root 6834 May 17 2017 README.md
-rwxr-xr-x. 1 root root 2433664 Jan 22 18:09 redis-benchmark
-rwxr-xr-x. 1 root root 25165 Jan 22 18:09 redis-check-aof
-rwxr-xr-x. 1 root root 5183694 Jan 22 18:09 redis-check-rdb
-rwxr-xr-x. 1 root root 2586683 Jan 22 18:09 redis-cli
-rw-rw-r--. 1 root root 46696 Jan 22 18:10 redis.conf
-rwxr-xr-x. 1 root root 5183694 Jan 22 18:09 redis-sentinel
-rwxr-xr-x. 1 root root 5183694 Jan 22 18:09 redis-server
-rwxrwxr-x. 1 root root 271 May 17 2017 runtest
-rwxrwxr-x. 1 root root 280 May 17 2017 runtest-cluster
-rwxrwxr-x. 1 root root 281 May 17 2017 runtest-sentinel
-rw-rw-r--. 1 root root 7606 May 17 2017 sentinel.conf
drwxrwxr-x. 2 root root 4096 Jan 22 18:05 src
drwxrwxr-x. 10 root root 4096 May 17 2017 tests
drwxrwxr-x. 7 root root 4096 May 17 2017 utils
删除rdb文件
rm -rf dump.rdb
恢复运行
./redis-server redis.conf
验证
127.0.0.1:6379> get k1
(nil)
数据恢复失败,原因是rdb被删除了
边栏推荐
- 什么是僵尸网络
- Constraintlayout control uses full Raiders
- About multi table query of MySQL
- 【LeetCode】59. Spiral matrix II
- [sans titre]
- 118. Yanghui triangle
- JVM的符号引用和直接引用是什么
- 【Leetcode】76. 最小覆盖子串
- Recyclerview implements flow layout (LinearLayout with line wrap) (flexboxlayoutmanager)
- Cloud native essay using Hana expression database service on Google kubernetes cluster
猜你喜欢
随机推荐
MySQL Chapter 4 Summary
Appium automation test foundation - mobile end test environment construction (II)
What are the symbolic and direct references of the JVM
904. fruit baskets
Global and Chinese market of contemporary lampshade 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market of aluminum sunshade systems 2022-2028: Research Report on technology, participants, trends, market size and share
MySQL第八次作业
[untitled]
Call API interface to generate QR code of wechat applet with different colors
MySQL Chapter 6 Summary
Jar version conflict resolution
Little red book - Summary of internal sales spike project
六月集训(第26天) —— 并查集
[sans titre]
String class intern() method and string constant pool
【無標題】
动态库连接 - 符号冲突 - 全局符号介入
MySQL第十二次作业-存储过程的应用
libmagic 介绍
Recyclerview implements flow layout (LinearLayout with line wrap) (flexboxlayoutmanager)