Redis主从同步

下载-->解压-->编译安装-->配置-->启动

注意点:

1. 启动指定配置文件redis-server /etc/redis.conf,否则默认读取的是安装目录下的conf文件

2. 从服务器上  /etc/redis.conf中slaveof 10.12.0.3 6379 配置主机地址。

3. redis-cli 检查状态

 

参考:

http://www.linuxidc.com/Linux/2016-03/129301.htm

http://blog.csdn.net/ling811/article/details/53637257

 

redis dump.rdb appendonly.aof 文件路径修改

# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
#
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir  ./

-------------------------

这里默认是启动后的相对路径也就是你的Redis在哪里启动,dump.rdb 文件或者appendonly.aof 
文件就会产生在启动所在的目录;

这也就是有些人重启后key值消失的原因,那是因为又产生了其他ump.rdb 文件或者appendonly.aof

这里建议改成绝对路径

dir /usr/local/redis/data/

posted @ 2017-08-17 16:07  当年亦如是  阅读(197)  评论(0编辑  收藏  举报