Centos7 installs Redis cluster and RedisJson, RedisSearch modules
Centos7 installs Redis cluster and RedisJson, RedisSearch modules
Centos7 installs Redis cluster
Reference: https://me.jinchuang.org/archives/1104.html
The Redis cluster installation steps are completely based on the above blog content.
Virtual machine preparation
Use 3 machines, each machine has 2 nodes, system centos7, each machine communicates with each other
192.168.1.2 represents the first machine ip
192.168.1.3 represents the second machine ip
192.168.1.4 represents the third machine ip
Upgrade gcc [execute on all 3 machines]
安装ruby
yum install ruby rubygems -y
升级gcc(数字7表示7.x版本,8表示8.x版本)
yum install centos-release-scl devtoolset-7-gcc* -y
临时生效gcc版本
scl enable devtoolset-7 bash
永久生效gcc版本
echo 'source /opt/rh/devtoolset-7/enable' >>/etc/profile && source /etc/profile
Download and install Redis [execute on all 3 machines]
Create a new software directory on the virtual machine, for example: /root/software
进入software目录
cd software
[redis](/search?q=redis)
wget http://download.redis.io/releases/redis-6.0.6.tar.gz
解压缩
tar xf redis-6.0.6.tar.gz
cd redis-6.0.6
编译安装
make
make install PREFIX=/usr/local/redis
echo 'export PATH=$PATH:/usr/local/redis/bin' >>/etc/profile && source /etc/profile
Create directories and configuration files
# 第一台
mkdir -p /opt/redis-cluster/{7001,7002}
# 第二台
mkdir -p /opt/redis-cluster/{7003,7004}
# 第三台
mkdir -p /opt/redis-cluster/{7005,7006}
# 配置文件模板以7001节点为例(这里绑定本机ip和127.0.0.1),复制到其他节点目录下并改下ip和端口还有文件名称
cd /opt/redis-cluster/7001/
vim redis7001.conf
The content of the configuration file, taking node 7001 as an example:
# 配置内容
bind 192.168.1.2 127.0.0.1
port 7001
daemonize yes
cluster-enabled yes
cluster-config-file nodes7001