Redis 5.0.5 3台主机部署Cluster集群

一、1号服务器安装redis 5.0.5

1. 上传 redis-5.0.5.tar.gz 到/cib/software/redis(这个可自定义)目录下

– cd /cib/software/redis
– tar -zxvf redis-5.0.5.tar.gz

2. 安装redis 5.0.5

– cd /cib/software/redis/redis-5.0.5
– make && make install (如果这一步报错则执行以下命令)

1)make MALLOC=libc
2)cd src
3)make install

– cd /cib/software/redis
– mkdir redis-cluster
– cd redis-cluster
– mkdir 6379
– mkdir 6380

将/cib/software/redis/redis-5.0.5/redis.conf文件复制到6379、6380文件夹下面

– cd /cib/software/redis/redis-5.0.5
– cp redis.conf /cib/software/redis/redis-cluster/6379
– cp redis.conf /cib/software/redis/redis-cluster/6380

3.修改6379文件夹下面的redis.conf文件

bind 1号服务器ip
port 6379
daemonize yes
pidfile /var/run/redis-6379.pid
dbfilename dump6379.rdb
logfile /cib/software/redis/redis-cluster/6379/redis.log
dir /cib/software/redis/redis-cluster/6379
appendonly yes
appendfilename “appendonly6379.aof”
appendfsync always
cluster-enabled yes
cluster-config-file nodes-6379.conf
cluster-node-timeout 15000

4.修改6380文件夹下面的redis.conf文件

bind 1号服务器ip
port 6380
daemonize yes
pidfile /var/run/redis-6380.pid
dbfilename dump6380.rdb
logfile /cib/software/redis/redis-cluster/6380/redis.log
dir /cib/software/redis/redis-cluster/6380
appendonly yes
appendfilename “appendonly6380.aof”
appendfsync always
cluster-enabled yes
cluster-config-file nodes-6380.conf
cluster-node-timeout 15000

二、2、3号服务器参考1号服务器进行安装和配置

注意:唯一的区别是6379、6380下面的redis.conf中的bind 各自配置自己的ip

三、三台服务器都启动redis(可以加入path路径以后启动方便,这里就不加了)

– cd cd /cib/software/redis/redis-5.0.5/src
– ./redis-server /cib/software/redis/redis-cluster/6379/redis.con
– ./redis-server /cib/software/redis/redis-cluster/6380/redis.conf

☆☆☆☆☆需要开放防火墙ip和端口号否则执行下面命令会报错

四、创建集群

–redis-cli --cluster create 1号服务器:6379 1号服务器:6380 2号服务器:6379 2号服务器:6380 3号服务器:6379 3号服务器:6380 --cluster-replicas 1

参考链接:redis集群配置
redis集群搭建

你可能感兴趣的:(软件安装,linux服务器安装部署文档)