zoukankan      html  css  js  c++  java
  • redis中的aof模式,产生的是增量数据,还是全量数据?

    先说答案:全量数据。

    1、修改redis.conf,开启rdb,禁用aof

    上面这个是持久化文件的路径,我们ll看下:

    2、启动redis后,cli查看里面的key

    [root@mini1 redis-4.0.2]# src/redis-server ./redis.conf 

    [root@mini1 redis-4.0.2]# src/redis-cli 


    3、现在转换为aof模式

    在线转换参考:https://redis.io/topics/persistence

    How I can switch to AOF, if I'm currently using dump.rdb snapshots?
    There is a different procedure to do this in Redis 2.0 and Redis 2.2, as you can guess it's simpler in Redis 2.2 and does not require a restart at all.
    Redis >= 2.2
    Make a backup of your latest dump.rdb file.
    Transfer this backup into a safe place.
    Issue the following two commands:
    redis-cli config set appendonly yes
    redis-cli config set save ""
    Make sure that your database contains the same number of keys it contained.
    Make sure that writes are appended to the append only file correctly.
    The first CONFIG command enables the Append Only File. In order to do so Redis will block to generate the initial dump, then will open the file for writing, and will start appending all the next write queries.
    The second CONFIG command is used to turn off snapshotting persistence. This is optional, if you wish you can take both the persistence methods enabled.
    IMPORTANT: remember to edit your redis.conf to turn on the AOF, otherwise when you restart the server the configuration changes will be lost and the server will start again with the old configuration.
    

      

     在客户端cli执行:

    config set appendonly yes

    config set save ""

     4、新增几个key,生成aof文件,查看内容是否包含rdb中的内容

    [root@mini1 backup]# less appendonly.aof 

    结果如下:

    综上:说明aof生成的文件不是增量的,不是仅仅生成开启aof之后的命令的记录,而是包括全部的数据库记录

  • 相关阅读:
    go 注释/说明/文档 标注
    go stack object escape
    ubuntu virtualBox windows10 CPU占用100%
    git 团队合作
    git 修改远程pull和push地址
    go 项目编译失败
    fork函数 linux创建子进程
    51nod1183 编辑距离
    各种平衡树
    redis 配置多个ip 解决方案
  • 原文地址:https://www.cnblogs.com/grey-wolf/p/7686835.html
Copyright © 2011-2022 走看看