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

Redis data backup and recovery

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

Share

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

The Redis SAVE command is used to create a backup of the current database.

Grammar

The basic syntax for redis Save commands is as follows:

Redis 127.0.0.1 redis 6379 > SAVE instance redis 127.0.0.1 redis 6379 > SAVE OK

This command creates the dump.rdb file in the redis installation directory.

Recover data

If you need to recover the data, simply move the backup file (dump.rdb) to the redis installation directory and start the service. You can use the CONFIG command to get the redis directory, as follows:

Redis 127.0.0.1 dir 6379 > CONFIG GET dir1) "dir" 2) "/ usr/local/redis/bin"

The redis installation directory output from the above command CONFIG GET dir is / usr/local/redis/bin.

Bgsave

You can also use the command BGSAVE to create a redis backup file, which is executed in the background.

Instance 127.0.0.1 6379 > BGSAVE Background saving started

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