Redis 数据库迁移
2016-03-23 19:57
567 查看
这里说的数据库迁移,指的是,在一个服务器中生成的数据库文件,直接拷贝到另外一台服务器上,而且两台服务器可能使用的是不同的Redis端口及配置。
如果直接将数据库文件dump.rdb复制到另外一个Redis目录,对数据库进行操作,会发现,dump.rdb里面原来的数据没了,只有刚刚新添加的key-value。
其实解决办法很简单,只要更改一下Redis配置文件即可。
只要把save这几行注释掉,然后把生成的数据库文件复制过去,会发现,原来的数据还在,成功喽~~~
如果直接将数据库文件dump.rdb复制到另外一个Redis目录,对数据库进行操作,会发现,dump.rdb里面原来的数据没了,只有刚刚新添加的key-value。
其实解决办法很简单,只要更改一下Redis配置文件即可。
################################ SNAPSHOTTING ################################# # # Save the DB on disk: # # save <seconds> <changes> # # Will save the DB if both the given number of seconds and the given # number of write operations against the DB occurred. # # In the example below the behaviour will be to save: # after 900 sec (15 min) if at least 1 key changed # after 300 sec (5 min) if at least 10 keys changed # after 60 sec if at least 10000 keys changed # # Note: you can disable saving at all commenting all the "save" lines. # # It is also possible to remove all the previously configured save # points by adding a save directive with a single empty string argument # like in the following example: # # save "" save 900 1 save 300 10 save 60 10000
只要把save这几行注释掉,然后把生成的数据库文件复制过去,会发现,原来的数据还在,成功喽~~~
#save 900 1 #save 300 10 #save 60 10000
相关文章推荐
- Android之获取手机上的图片和视频缩略图thumbnails
- redis安装问题小结
- 数据库链接字符串查询网站
- 我是运营,我没有假期
- DB2实例管理
- DB2实例管理
- 保障MySQL数据安全的14个最佳方法
- mysql问答汇集
- 使用 Redis 和 Python 构建一个共享单车的应用程序
- 第三章 数据库备份和还原
- Redis偶发连接失败案例实战记录
- 创建一个空的IBM DB2 ECO数据库的方法
- Access 2000 数据库 80 万记录通用快速分页类
- 开通一个数据库失败的原因的和解决办法
- 一个简单的asp数据库操作类
- DB2数据库的安装
- C#实现把指定数据写入串口
- CentOS下DB2数据库安装过程详解
- “传奇”图象数据存储方式