win7+centoshtml
master and slave | ip | port |
master | 127.0.0.1--改爲局域網ip192.168.176.128 | 6379 |
slave1 | 127.0.0.1--改爲局域網ip192.168.176.128 | 6380 |
slave2 | 127.0.0.1--改爲局域網ip192.168.176.128 | 6381 |
wget http://download.redis.io/releases/redis-3.2.1.tar.gz
tar zxvf redis-3.2.1.tar.gzmv redis-3.2.1 redis-3.2.1.mastertar zxvf redis-3.2.1.tar.gzmv redis-3.2.1 redis-3.2.1.slave-1tar zxvf redis-3.2.1.tar.gzmv redis-3.2.1 redis-3.2.1.slave-2
cd redis-3.2.1.master/srcmake make test//其餘兩個目錄執行相同的操做
port 6379pidfile /var/run/redis_6379.pid# slaveof <masterip> <masterport>logfile "/data/logs/redis.master.log"daemonize yes
port 6380pidfile /var/run/redis_6380.pidslaveof 127.0.0.1 6379logfile "/data/logs/redis.slave-6380.log"daemonize yes
port 6381pidfile /var/run/redis_6381.pidslaveof 127.0.0.1 6379logfile "/data/logs/redis.slave-6381.log"daemonize yes
注意:在 / 根目錄在創建redis
/data/logs/redis.master.log
centos
/data/logs/redis.slave-6380.log
測試
/data/logs/redis.slave-6381.log
spa
3、開啓master和slave一、slave2
3d
./src/redis-server redis.conf
redis-cli -h 127.0.0.1 -p 6379
參考原文:http://www.cnblogs.com/ssslinppp/p/5661419.html
日誌