redis three master three slave deployment

Server A: 192.168.3.188 centos7
Server B: 192.168.3.189 centos7
Turn off firewalld firewall and selinux;
Redis version 4.0.1, at least 6 sets of redis cluster

yum -y install wget vim tcl gcc make
mkdir –p /usr/local/redis
cd !$
wget http://download.redis.io/releases/redis-4.0.1.tar.gz
tar –xvf redis-4.0.1.tar.gz
make
make test-No mistake. Go on
//It's wrong
/usr/local/redis/redis-4.0.1/tests/integration
replication-2.tcl Inside after 10000
//Copy redis command to environment variable
cp -a src/redis-server src/redis-cli src/redis-sentinel src/redis-trib.rb src/redis-check-aof src/redis-check-rdb src/redis-benchmark /usr/local/bin/
mkdir cluster-redis
cd cluster-redis
mkdir {7000,7001,7002}

One of the redis.conf configuration file contents

bind 192.168.3.188
protected-mode yes
port 7000
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/redis_7000.pid
loglevel notice
logfile "/usr/local/redis/cluster-redis/7000/redis_7000.log"
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump7000.rdb
dir /usr/local/redis/cluster-redis/7000/
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
appendonly yes
appendfilename "appendonly7000.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lua-time-limit 5000
cluster-enabled yes
cluster-config-file nodes-7000.conf
cluster-node-timeout 15000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

Modify the corresponding port and database name in other redis configuration files
Start redis in turn

redis-server /usr/local/redis/cluster-redis/7000/redis.conf
redis-server /usr/local/redis/cluster-redis/7001/redis.conf
redis-server /usr/local/redis/cluster-redis/7002/redis.conf-The other server also starts three redis node

Install the following two dependencies in advance: zlib and openssl

yum -y install zlib-devel
yum install openssl-devel -y
 Then install ruby, ruby-2.3.4.tar.gz, decompress, compile and install
./configure
Make && make install
 Ruby – v version above 2.2.2

Install redis. If it cannot be installed, switch the gem source. See the following link to replace the gem source
https://ruby.taobao.org/

Gem install redis

Start cluster

redis-trib.rb create --replicas 1 192.168.3.188:7000 192.168.3.188:7001 192.168.3.188:7002 192.168.3.189:7000 192.168.3.189:7001 192.168.3.189:7002

Log in to a node

redis-cli 192.168.3.188 -c -p 7001

View cluster status

cluster info
cluster nodes

Tags: Linux Redis Ruby yum zlib

Posted on Mon, 09 Dec 2019 14:40:48 -0800 by Ruud Hermans