How to Setup Redis Replication

How to Setup Redis Replication
How to Setup Redis Replication

What is Redis?

Why does Redis perform so well?

Starting up Redis

yum install redis
systemctl start redis
systemctl enable redis
systemctl status redis
Configuring Redis Master Server
Open the Redis config file, using the /etc/redis.conf.
vi /etc/redis.conf

Configuring Redis’ replica servers

Setting up Redis instance as a replica

Verifying master-replica status

redis-cli
127.0.0.1:6379> AUTH DLT@DevOps44
127.0.0.1:6379> info replication
# Replication
role:master
connected_slaves:2
slave0:ip=10.36.0.211,port=6379,state=online,offset=5849,lag=1
slave1:ip=10.37.0.122,port=6379,state=online,offset=5849,lag=1
master_repl_offset:5849
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:2
repl_backlog_histlen:5848
# Replication
role:slave
master_host: 10.35.0.110
master_port:6379
master_link_status:up
master_last_io_seconds_ago:1
master_sync_in_progress:0
slave_repl_offset:41519
slave_priority:100
slave_read_only:1
connected_slaves:0
min_slaves_good_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

Testing your setup

redis-cli
127.0.0.1:6379> AUTH DLT@DevOps44
127.0.0.1:6379> set org ‘DLTLabs’
redis-cli
127.0.0.1:6379> get org

Written by

DLT Labs is a global leader in Distributed Ledger Technology and Enterprise Products. To know more, head over to: https://www.dltlabs.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store