系統(tǒng): centos-7.2-x64
redis: redis-5.0.8
redis-5.0.8_centos7.2_x64
鏈接: https://pan.baidu.com/s/1rL-UHqIw0LZNoW38vXuSQg
提取碼: sdm9
redis-5.0.8_centos6.8_x64
鏈接: https://pan.baidu.com/s/126sPkX-bf5VpptnCmWoUMQ
提取碼: x58h
1狂秘、程序目錄下創(chuàng)建config目錄
2谱仪、創(chuàng)建3配置文件
一個主節(jié)點6381,兩個從節(jié)點6382和6383面粮,都未設(shè)置密碼
master-6381.conf
bind 0.0.0.0
port 6381
logfile "6381.log"
dbfilename "dump-6381.rdb"
daemonize yes
rdbcompression yes
requirepass "123456"
masterauth "123456"
slave-read-only no
slave-6382.conf
bind 0.0.0.0
port 6382
logfile "6382.log"
dbfilename "dump-6382.rdb"
daemonize yes
rdbcompression yes
requirepass "123456"
masterauth "123456"
slave-read-only no
slaveof 127.0.0.1 6381
slave-6383.conf
bind 0.0.0.0
port 6383
logfile "6383.log"
dbfilename "dump-6383.rdb"
daemonize yes
rdbcompression yes
requirepass "123456"
masterauth "123456"
slave-read-only no
slaveof 127.0.0.1 6381
3、啟動三個節(jié)點,先主后從
./redis-server config/master-6381.conf
./redis-server config/slave-6382.conf
./redis-server config/slave-6383.conf
4胶哲、驗證集群
5、主節(jié)點可讀寫,從節(jié)點只可讀
./redis-cli -p 6381
-p
: 指定端口