标签:
1,选择两台服务器
2,安装redis
wget http://download.redis.io/releases/redis-2.8.12.tar.gz
tar -xvf redis-2.8.12.tar.gz
cd redis-2.8.12
make
3,配置
vi redis.conf
主修改
daemonize yes
bind 192.168.1.1
requirepass 123456
slave节点修改
daemonize yes
bind 192.168.1.2
slaveof 192.168.1.1 6379
masterauth 123456
4,启动主次节点
src/redis-server redis.conf
5,验证
连接主节点
src/redis-cli -h 192.168.1.1
需要先验证才能读写
auth 123456
set name ok
src/redis-cli -h 192.168.1.2
get name
显示
ok
set name ok2
显示
READONLY You can‘t write against a read only slave.
标签:
原文地址:http://blog.csdn.net/liuzhoulong/article/details/50601539