1.下载安装redis http://download.redis.io/releases/
2.建立一个主7060和一个从7061文件
3.在两个文件夹中建立用于存放数据得db文件和存日志得log文件
4.copy一个主master
5.配置redis_master.conf
修改端口号port 7060
修改pid: 换成刚刚创建得路径
pidfile /etc/redis/redis_slave/7060/redis-server.pid
修改日志log
logfile /etc/redis/redis_slave/7060/log/redis-server.log
修改存放数据目录dir
dir /etc/redis/redis_slave/7060/db/
保存
6.执行,会发现有一个6379端口 用sudo service redis-server stop来停止
连接7060
7.cpoy一个从服务器master_slave.conf
8.配置master_slave.conf
修改端口
port 7061
pidfile /etc/redis/redis_slave/7061/redis-server.pid
修改日志log
logfile /etc/redis/redis_slave/7061/log/redis-server.log
修改存放数据目录dir
dir /etc/redis/redis_slave/7061/db/
修改slaveof进行数据同步
slaveof <masterip> <masterport>
slaveof 127.0.0.1 7060
9.启动从服务器
查看
从服务器只能读