解压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