Redis群集

解压redis

[root@centos01 ~]# tar zxvf /mnt/redis-3.2.9.tar.gz -C /usr/src/

在这里插入图片描述

指定安装位置

[root@centos01 ~]# mv /usr/src/redis-3.2.9/ /usr/local/redis

在这里插入图片描述

编译安装redis

[root@centos01 redis]# make install

在这里插入图片描述

运行redis安装脚本

[root@centos01 redis]# ./utils/install_server.sh

监听端口

[root@centos01 ~]# netstat -anptu | grep 6379

在这里插入图片描述

修改主配置文件

[root@centos01 ~]# vim /etc/redis/6379.conf

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

启动服务

[root@centos01 ~]# /etc/init.d/redis_6379 start
[root@centos01 ~]# netstat -anptu | grep 6379

在这里插入图片描述

SCP向其他节点服务器传输文件

[root@centos01 ~]# scp /mnt/redis-3.2.9.tar.gz root@192.168.100.20:/usr/src/


【以此类推】
[root@centos01 ~]# scp /mnt/redis-3.2.9.tar.gz root@192.168.100.60:/usr/src/

在这里插入图片描述

【Centos02】

[root@centos02 ~]# cd /usr/src/
[root@centos02 src]# tar zxvf redis-3.2.9.tar.gz 
[root@centos02 src]# mv redis-3.2.9 /usr/local/redis
[root@centos02 src]# cd /usr/local/redis/
[root@centos02 redis]# make && make install
[root@centos02 redis]#  ./utils/install_server.sh
[root@centos02 redis]# /etc/init.d/redis_6379 stop
[root@centos02 redis]# scp root@192.168.100.10:/etc/redis/6379.conf /etc/redis/
[root@centos02 redis]# vim /etc/redis/6379.conf 

在这里插入图片描述

【!!!以上其他四台服务器也要操作!!!】
清理缓存

[root@centos02 redis]# redis-cli -h 192.168.100.10 -p 6379

在这里插入图片描述

【!!!六台服务器均需要清理缓存!!!】
安装群集依赖文件

[root@centos01 ~]# mount /dev/cdrom /mnt/     //更换为Linux盘
[root@centos01 ~]# rm -rf /etc/yum.repos.d/CentOS-*
[root@centos01 ~]# yum -y install ruby

在这里插入图片描述

[root@centos01 ~]# gem install redis-3.2.0.gem --version 3.2.0

在这里插入图片描述

创建群集将节点加入群集

[root@centos01 ~]# /usr/local/redis/src/redis-trib.rb create --replicas 1 192.168.100.10:6379 192.168.100.20:6379 192.168.100.30:6379 192.168.100.40:6379 192.168.100.50:6379 192.168.100.60:6379

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值