当前位置:网站首页>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被删除了
边栏推荐
- JS reverse | four libraries and one platform response data encryption
- Record the handling of oom problems caused by too many threads at one time
- exec系列函数(execl、execlp、execle、execv、execvp)使用
- Glide's most common instructions
- Luogu 1146 coin flip
- The first batch of 12 enterprises settled in! Opening of the first time-honored product counter in Guangzhou
- In the fragment, the input method is hidden after clicking the confirm cancel button in the alertdialog (this is valid after looking for it on the Internet for a long time)
- What is LSP
- MySQL第五章总结
- MySQL project 8 summary
猜你喜欢

MySQL第八次作业

Allocation de mémoire tas lors de la création d'objets

Selection of webrtc video codec type VP8 H264 or other? (openh264 encoding, ffmpeg decoding)

Hcia-dhcp experiment

The fourteenth MySQL operation - e-mall project

SSH, SCP command appears permission denied, please try again solution

Reshape a two-dimensional array with 3 rows and 3 columns to find the sum of the diagonals

MySQL learning summary

如何更改微信小程序二维码物料颜色

【Leetcode】76. 最小覆盖子串
随机推荐
MySQL Chapter 6 Summary
二叉树常见面试题
118. Yanghui triangle
2. merge two ordered arrays
Global and Chinese market for change and configuration management software 2022-2028: Research Report on technology, participants, trends, market size and share
MySQL project 8 summary
[sans titre]
What is LSP
Crawler related articles collection: pyppeter, burpsuite
How QT uses quazip to compress and decompress files
Yarn package management tool
[depth first search] 312 Poke balloon
904. fruit baskets
利用foreach循环二维数组
MySQL第十一作业-视图的应用
Recyclerview implements flow layout (LinearLayout with line wrap) (flexboxlayoutmanager)
MySQL learning summary
國際化配置
3行3列整形二维数组,求对角之和
Glide's most common instructions