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-aof recovery

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

Share

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

Aof recovery brief procedure:

[root@ZFRC-YW-YJF-TEST-370123 redis] # pkill-9 redis

[root@ZFRC-YW-YJF-TEST-370123 ~] # cd / var/dir

[root@ZFRC-YW-YJF-TEST-370123] # rm-rf *

Clear the existing environment backup files; then start the server process to add new data

[root@ZFRC-YW-YJF-TEST-370123 redis] #. / bin/redis-server. / redis.conf

[root@ZFRC-YW-YJF-TEST-370123 redis] #. / bin/redis-server. / redis6380.conf

[root@ZFRC-YW-YJF-TEST-370123 redis] #. / bin/redis-server. / redis6381.conf

[root@ZFRC-YW-YJF-TEST-370123 redis] #. / bin/redis-cli

127.0.0.1 6379 > keys *

(empty list or set)

127.0.0.1 purl 6379 > set site www.baidu.com

OK

127.0.0.1 purl 6379 > set name yjf

OK

127.0.0.1 purl 6379 > set addr bj

OK

127.0.0.1 purl 6379 > flushall

OK

127.0.0.1 purl 6379 > get name

(nil)

At this point, be sure to stop the service to avoid writing to others and rewrite the aof. And aof records that there are also flushall operations.

[root@ZFRC-YW-YJF-TEST-370123 dir] # more laoyang-appendonly.aof

two

$6

SELECT

, 1

0

three

$3

Set

$4

Site

$13

Www.baidu.com

three

$3

Set

$4

Name

$3

Yjf

three

$3

Set

$4

Addr

$2

Bj

, 1

$8

Flushall

127.0.0.1 6379 > shutdown nosave-shutdown operation does not log

Not connected >

Then edit the aof generation file. Drop the last dangerous operation flushall to dd. Pay attention to the format of the record, which usually begins with * and ends with the command.

[root@ZFRC-YW-YJF-TEST-370123 dir] # vim laoyang-appendonly.aof

Delete the following three lines and save exit

, 1

$8

Flushall

Then restart the service, log in to query, if not, log in again after exit

[root@ZFRC-YW-YJF-TEST-370123 redis] #. / bin/redis-server. / redis.conf

[root@ZFRC-YW-YJF-TEST-370123 redis] #. / bin/redis-cli

127.0.0.1 purl 6379 > get name

(nil)

127.0.0.1 purl 6379 > exit

[root@ZFRC-YW-YJF-TEST-370123 redis] #. / bin/redis-cli

127.0.0.1 purl 6379 > get name

Yjf

Check the rdb file

[root@ZFRC-YW-YJF-TEST-370123 redis] #. / bin/redis-check-rdb / var/dir/dump6380.rdb

[offset 0] Checking RDB file / var/dir/dump6380.rdb

[offset 27] AUX FIELD redis-ver = '3.2.13'

[offset 41] AUX FIELD redis-bits = '64'

[offset 53] AUX FIELD ctime = '1561537890'

[offset 68] AUX FIELD used-mem = '880976'

[offset 77] Checksum OK

[offset 77]\ o / RDB looks OK!\ o /

[info] 0 keys read

[info] 0 expires

[info] 0 already expired

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