zoukankan      html  css  js  c++  java
  • RDB转化AOF 花式删库

    运行一段时间默认的RDB后  转化成AOF 不能直接转换  会造成数据大量丢失

    [root@centos7 ~]#vim /apps/redis/etc/redis.conf
    # Please check http://redis.io/topics/persistence for more information.
    
    appendonly yes        #开关

    因为前期没启用AOF  所以没有AOF文件  同时启用RDB和AOF 优先从AOF读取

    一旦重启 数据全消失   并生成aof文件

    [root@centos7 ~]# systemctl restart redis
    [root@centos7 ~]# redis-cli
    127.0.0.1:6379> info
    
    # Keyspace
    [root@centos7 ~]# ll /data/redis
    total 146008
    -rw-r--r-- 1 redis redis                 0     Oct 21 10:45 appendonly.aof
    -rw-r--r-- 1 redis redis         149509867     Oct 21 10:43 dump_6379.rdb

    随便加点数据存一下

    127.0.0.1:6379> set date 1010
    OK
    127.0.0.1:6379>bgsave             
    [root@centos7 ~]# ll /data/redis
    total 146008
    -rw-r--r-- 1 redis redis                56     Oct 21 12:25 appendonly.aof
    -rw-r--r-- 1 redis redis               106     Oct 21 12:20 dump_6379.rdb

    这时候如果没有其他备份    直接GG

    正确的姿势

    在交互式redis中启用aof

    [root@centos8 ~]#redis-cli
    127.0.0.1:6379> config get appendonly
    1) "appendonly"
    2) "no"
    127.0.0.1:6379> config set appendonly yes
    OK
    [root@centos8 ~]#ll /data/redis
    total 366760
    -rw-r--r-- 1 redis redis 187779391 Oct 21 12:25 appendonly.aof
    -rw-r--r-- 1 redis redis 187779391 Oct 21 12:20 dump.rdb 
    [root@centos7 ~]#vim /apps/redis/etc/redis.conf
    # Please check http://redis.io/topics/persistence for more information.
    
    appendonly yes        #这回再开启aof配置文件
    [root@centos7 ~]# systemctl restart redis

    稳妥

  • 相关阅读:
    生成R文件
    android开发问题汇总
    雅虎股票接口
    Ext4.1 , #Ext4.2
    MSSQL手工注入 报错注入方法
    MSSQL 数据库复制脚本
    Go VS Code 调式常见问题处理
    Win10 VS2012 无法注册IIS4.0 解决方案
    VirtualBox 局域网独立主机设置
    如何用.reg文件操作注册表
  • 原文地址:https://www.cnblogs.com/zhangty333/p/13857514.html
Copyright © 2011-2022 走看看