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 backup and recovery

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

Share

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

Redis backup and recovery

1.redis backup

[root@caosm103 redis] # redis-cli-h 192.168.24.129-p 6379 # Connect to the server

192.168.24.129 6379 > SAVE # backup with save

OK

192.168.24.129 6379 > CONFIG GET dir # View the installation directory of the service

1) "dir"

2) "/ data/redis" # directory of service data backup

2.redis recovery

To recover the data, just put the dump.rdb file in the redis installation directory, start the service, and the data will be restored.

Note: the save command is not executed. When you close redis-server manually, the dump.rdb file will be created automatically.

[root@caosm103 redis] # ll-h

Total 12K

-rw-r--r-- 1 redis redis 12K Nov 16 10:05 dump.rdb

[root@caosm103 redis] # / etc/init.d/redis-server stop

Stopping redis-server: [OK]

[root@caosm103 redis] # / etc/init.d/redis-server start

Starting redis-server: [OK]

[root@caosm103 redis] # redis-cli-h 192.168.24.129-p 6379

192.168.24.129 6379 > DBSIZE

(integer) 1

192.168.24.129 6379 > KEYS *

1) "prizeNum

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