Sunday, May 27, 2018

Redis Cluster on Centos 7


1. Install redis on all nodes
yum install -y epel-release
yum install -y redis

2. Configure master
vi /etc/redis.conf  # update the following line: bind 127.0.0.1
firewall-cmd --add-port=6379/tcp

3. Configure slaves
vi /etc/redis.conf  # update the following line: slaveof 6379

4. Restart and enable redis on all nodes
systemctl enable --now redis

5. Login to master and create a key to validate
127.0.0.1:6379> info replication
127.0.0.1:6379> redis-cli
127.0.0.1:6379> set 'a' 1

6. verify on the nodes that the replication is working
127.0.0.1:6379> redis-cli
127.0.0.1:6379> get 'a'  # you must get correct value set from the master
127.0.0.1:6379> info replication

No comments:

Post a Comment