redis three master three slave deployment

Server A: centos7
Server B: 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 !$
tar –xvf redis-4.0.1.tar.gz
make test-No mistake. Go on
//It's wrong
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

protected-mode yes
port 7000
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/
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
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

Gem install redis

Start cluster

redis-trib.rb create --replicas 1

Log in to a node

redis-cli -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