centos7 搭建Redis的三主三从集群模式
单机和多实例部署 https://www.cnblogs.com/wangenzhi/p/10562761.html
集群部署 https://www.cnblogs.com/hardy-wang/p/13846585.html
redis 3.x安装redis集群
1.需要准备redis-trib.rb的运行环境
wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.gz
yum -y install zlib-devel
tar xvf ruby-2.5.1.tar.gz
cd ruby-2.5.1/
./configure -prefix=/usr/local/ruby
make
make install
cd /usr/local/ruby/
cp bin/ruby /usr/local/bin
cp bin/gem /usr/local/bin
2、安装redis-trib依赖
wget http://rubygems.org/downloads/redis-3.3.0.gem
gem install -l redis-3.3.0.gem
3.进入src目录启动
./redis-trib.rb create --replicas 1 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 127.0.0.1:7006
replicas 1 每个master对应slave的数量
安装redis5.5以上的版本需要升级gcc
升级gcc
1.yum -y install centos-release-scl
2.yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
3.scl enable devtoolset-9 bash(临时升级gcc,当前bash有效)
4.echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile(永久升级gcc,线上环境慎用)
redis缺少gcc现象:https://blog.csdn.net/qq_45069833/article/details/108762535
redis集群常用命令:https://my.oschina.net/guol/blog/506193