1、测试平台redis集群各个实例角色
2、测试平台reids逻辑架构图
3、Redis各个节点配置
3.1 40服务器16379端口配置文件redis.conf
bind 192.168.100.40 127.0.0.1
protected-mode no
port 16379
daemonize yes
appendonly yes
cluster-enabled yes
cluster-config-file nodes_16379.conf
cluster-node-timeout 15000
3.2 40服务器16380端口配置文件redis.conf
bind 192.168.100.40 127.0.0.1
protected-mode no
port 16380
daemonize yes
appendonly yes
cluster-enabled yes
cluster-config-file nodes_16380.conf
cluster-node-timeout 15000
3.3 40服务器16380端口配置文件redis.conf
bind 192.168.100.40 127.0.0.1
protected-mode no
port 16381
daemonize yes
appendonly yes
cluster-enabled yes
cluster-config-file nodes_16381.conf
cluster-node-timeout 15000
3.4 38服务器16379端口配置文件redis.conf
bind 192.168.100.38 127.0.0.1
protected-mode no
port 16379
daemonize yes
appendonly yes
cluster-enabled yes
cluster-config-file nodes_16379.conf
cluster-node-timeout 15000
3.5 38服务器16380端口配置文件redis.conf
bind 192.168.100.38 127.0.0.1
protected-mode no
port 16380
daemonize yes
appendonly yes
cluster-enabled yes
cluster-config-file nodes_16380.conf
cluster-node-timeout 15000
3.6 38服务器16381端口配置文件redis.conf
bind 192.168.100.38 127.0.0.1
protected-mode no
port 16381
daemonize yes
appendonly yes
cluster-enabled yes
cluster-config-file nodes_16381.conf
cluster-node-timeout 15000
4、redis各个节点启动
(1)进入38,40服务器各个节点配置文件目录
命令:redis-server redis.conf &
(2)各个节点启动之后,进入/usr/local/src/redis/redis-3.2.8/src目录
命令:./redis-trib.rb create --replicas 1 192.168.100.40:16379 192.168.100.38:16379 192.168.100.38:16380 192.168.100.40:16380 192.168.100.40:16381 192.168.100.38:16381
(3)集群构建完毕再通过config set + config rewrite命令逐个节点设置密码
config set masterauth Alphago@2017
config set requirepass Alphago@2017