安装插件参考这里 https://www.cnblogs.com/molson/p/13531163.html 20210818
redis5一下不支持--cluster选项
/opt/software/redis-5.0.9/src/redis-cli --cluster create 192.168.1.24:7001 192.168.1.24:7002 192.168.1.24:7003 192.168.1.24:7004 192.168.1.24:7005 192.168.1.24:7006 --cluster-replicas 1
参考链接 https://blog.csdn.net/qq_25763595/article/details/107731611
mkdir /data/software/ #上传后的软件包都放这里
1.在每台机器上安装基础环境---------------------------------
安装 gcc g++
yum install -y gcc #不能yum就按下面连接来,g++好像不用安装
1.安装 rvm
下载 rmv
https://github.com/rvm/rvm/tags
cd /data/software/
tar -xzf rvm-1.29.9.tar.gz
cd rvm-1.29.9
./install --auto-dotfiles
source /data/software/rvm-1.29.9/scripts/rvm
rvm -v
2.安装 ruby
下载ruby,系统yum安装的是2.0 版本不正常的
地址一:https://www.ruby-lang.org/en/downloads/
yum -y remove ruby
tar -zxvf ruby-3.0.2.tar.gz
cd ruby-3.0.2
./configure
make && make install
ln -s /usr/local/bin/ruby /usr/bin/ruby
ruby -v
3.安装 rubygems
下载 rubygems
https://rubygems.org/pages/download
tar -zxvf rubygems-3.2.25.tgz
cd rubygems-3.2.25
ruby setup.rb
4.安装 redis gem
redis-4.1.0.gem 下载(如果下载不了去本地找下吧)
链接:https://pan.baidu.com/s/16e4SxPCJdb8ONQMjIB6U4g 提取码:evkg
ln -s /usr/local/bin/gem /usr/bin/gem
cd ../rubygems-3.2.25
gem install -l ../redis-4.1.0.gem
2.在每台机器上安装Redis-----------------------------------------------------------
tar -zxvf redis-5.0.5.tar.gz
cd redis-5.0.5
make install PREFIX=/usr/local/redis/
cd /usr/local/redis/bin/
./redis-server
复制安装包配置文件到redis安装目录
mkdir -p /usr/local/redis/conf
cp /data/software/redis-5.0.5/redis.conf /usr/local/redis/conf/redis-7001.conf
#配置集群修改配置文件,修改完这个再复制成其他端口配置文件
cd /usr/local/redis/conf/
修改redis.conf
vim redis-7001.conf
注意:下面内容,可以直接输入“/查找的内容”,按回车进行查找 Ⅰ.编辑redis.conf:vim redis.conf Ⅱ.修改端口号:port 7001 Ⅲ.启动后台运行:daemonize yes Ⅳ.修改集群:cluster-enabled yes Ⅵ.修改bind地址:bind 添加redis服务ip 比如 bind 192.168.1.200
requirepass GZml136!3^ 设置密码
masterauth GZml136!3^ 设置集群连接的密码
#集群需要修改什么参考上面集群方式安装的文档
cp redis-7001.conf redis-7002.conf
cp redis-7001.conf redis-7003.conf
#新建集群启动脚本
vim redis-start.sh
#!/bin/bash /usr/local/redis/bin/redis-server /usr/local/redis/conf/redis-7001.conf /usr/local/redis/bin/redis-server /usr/local/redis/conf/redis-7002.conf /usr/local/redis/bin/redis-server /usr/local/redis/conf/redis-7003.conf
启动redis
sh /usr/local/redis/redis-start.sh
3.在任意一台配置创建多主机集群
cd /usr/local/redis
vi redis-cluster.sh
#!/bin/bash /usr/local/redis/bin/redis-cli --cluster create 176.16.13.215:7001 176.16.13.215:7002 176.16.13.215:7003 176.16.13.153:7001 176.16.13.153:7002 176.16.13.153:7003 --cluster-replicas 1
启动集群
sh /usr/local/redis/redis-cluster.sh