Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to check whether redis is persisted

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to check whether the redis is persistent, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Info to view persistence information

Redis-cli info persistence#

Loading: whether the server is loading persistent files

Rdb_changes_since_last_save: the number of written commands since the last rdb file was successfully generated, that is, how many write commands have not been persisted

Rdb_bgsave_in_progress: whether the server is creating a rdb file

Rdb_last_save_time: the timestamp since the last successful creation of the rdb file. Current timestamp-how many seconds did rdb_last_save_time= fail to generate the rdb file

Rdb_last_bgsave_status: whether the last rdb persistence was successful

Rdb_last_bgsave_time_sec: the number of seconds it took to successfully generate the rdb file last time

Rdb_current_bgsave_time_sec: if the server is creating a rdb file, then this domain records the number of seconds that the current creation operation has taken

The number of modifications performed by the parent process compared to the child process during the rdb_last_cow_size:RDB process (including read buffer, write buffer, data modification, etc.).

Aof_enabled: whether aof is enabled

Aof_rewrite_in_progress: identifies whether the rewrite operation of the aof is in progress

Aof_rewrite_scheduled:rewrite task planning, when the client sends a bgrewriteaof instruction, if the current rewrite child process is executing, then change the bgrewriteaof requested by the client into a scheduled task, and execute the rewrite after the end of the AOF subprocess

Aof_last_rewrite_time_sec: how long did the last aof rewrite take

Aof_current_rewrite_time_sec: if the rewrite operation is in progress, record the time used (in seconds)

Aof_last_bgrewrite_status: status of the last bgrewriteaof operation

Aof_last_write_status: status of the last aof write

The number of modifications performed by the parent process compared to the child process during the aof_last_cow_size:AOF process (including read buffer, write buffer, data modification, etc.).

Appendfsync has three options: always, everysec, and no:

1. When selecting always, the server will forcibly write the contents of the AOF buffer to the AOF file on your hard disk every time you execute an event. It can be seen that every time you execute a redis write command, you record this command in the AOF file, which ensures the integrity of data persistence, but the efficiency is the slowest and the safest.

2. If everysec is configured, every time the server performs a write operation (such as set, sadd, rpush), it will append the command to the end of a separate AOF buffer and write the AOF buffer to the AOF file, and then file synchronization will be carried out every second to write the AOF cache data in the memory buffer into the AOF file. This mode not only takes into account the efficiency, but also ensures the integrity of the data. Even if the server is down, only the changes made to the redis database within one second will be lost.

3, configuring appendfsync as no means that you can accept the loss of data in the redis database, and it will append each write command to the end of the AOF buffer and then write to the file, but when to synchronize the file to really write the data into the AOF file is determined by the system itself, that is, when the memory buffer space is filled up or exceeds the set time limit, the system automatically synchronizes. The efficiency is the fastest in this mode, but it is also the least secure for the data. If the data in redis is extracted from the backend database such as mysql and belongs to data that can be recovered at any time or is unimportant, then you can consider setting it to this mode.

The above is how to check whether redis is persistent or not, thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report