Install Redis Cluster ¶
download installation package ¶
cd /opt/
wget https://rmc.webex.com/qa/systuning/centos7_64/WBXredis-6.2.4-1.el7.x86_64.rpm
wget https://rmc.webex.com/qa/systuning_src/centos7_64/rubygem-redis-3.3.3-1.src.rpm
installation commad ¶
rpm -ivh rubygem-redis-3.3.3-1.src.rpm --nodeps --force
rpm -ivh WBXredis-6.2.4-1.el7.x86_64.rpm --nodeps --force
configure redis cluster ¶
- configuration information
mkdir -p /opt/redis/conf cd /opt/redis/conf mkdir 6379 6380 - add redis-6379.conf and redis-6380.conf in 6379 and 6380 folders respectively
- vi 6379/redis.conf
port 6379 daemonize yes protected-mode no dir /var/log/redis/ maxmemory 5gb maxmemory-policy volatile-lfu dbfilename redis-6379.rdb rdbcompression yes appendonly no slowlog-max-len 1000 slowlog-log-slower-than 1000 cluster-enabled yes cluster-config-file nodes-6379.conf cluster-require-full-coverage no requirepass Ch4ll3ng3M3! loglevel notice logfile /var/log/redis/6379.log cluster-node-timeout 3000 masterauth Ch4ll3ng3M3! - vi 6380/redis.conf
port 6380 daemonize yes protected-mode no dir /var/log/redis/ maxmemory 5gb maxmemory-policy volatile-lfu dbfilename redis-6380.rdb rdbcompression yes appendonly yes appendfsync no auto-aof-rewrite-min-size 100mb no-appendfsync-on-rewrite yes appendfilename redis-6380.aof slowlog-max-len 1000 slowlog-log-slower-than 1000 cluster-enabled yes cluster-config-file nodes-6380.conf cluster-require-full-coverage no requirepass Ch4ll3ng3M3! loglevel notice logfile /var/log/redis/6380.log cluster-node-timeout 3000 masterauth Ch4ll3ng3M3!
- vi 6379/redis.conf
- Create the corresponding folder according to the configuration information
mkdir -p /var/log/redis
Start redis ¶
/opt/redis/bin/redis-server /opt/redis/conf/6379/redis.conf
/opt/redis/bin/redis-server /opt/redis/conf/6380/redis.conf
Problems that may encounter: ¶
- Q:error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
- A:Update the yum source. And then starting redis again.If update failed, you need to manually install "compat-openssl10-1.0.2o-3.el8.x86_64.rpm" package.
Start-up redis cluster ¶
- All servers must start Redis according to above steps
/opt/redis/bin/redis-cli --cluster create 10.225.28.13:6379 10.225.28.156:6379 10.225.28.198:6379 10.225.28.13:6380 10.225.28.156:6380 10.225.28.198:6380 --cluster-replicas 1 -a Ch4ll3ng3M3! - the following method is used to set the specified master-slave
# Please remember the ID of each redis master /opt/redis/bin/redis-cli --cluster create 10.225.28.13:6379 10.225.28.156:6379 10.225.28.198:6379 --cluster-replicas 0 -a Ch4ll3ng3M3! - Specify the slave library for each redis mater
/opt/redis/bin/redis-cli --cluster add-node --cluster-slave --cluster-master-id 59c509259473f73f88fb000b2e9e4b3dd92d3088 10.225.28.13:6380 10.225.28.198:6379 -a Ch4ll3ng3M3!