Monday, 6 October 2014

Installing redis server

Hi, folks
I am gonna show you how to install 'redis' server and setup master slave on a linux
box. Redis is a key-value-store database and is an open source. Here I'll set up two redis instance one acting as a master and other slave - location /opt and /var

Steps for the Redis Configuration :

Step 1:

Redis Download :

Step 2:
Then extract it :
# tar -zxvf redis-2.6.10.tar.gz# cd redis-2.6.10

Step 3 :
Run make

Step 4 :
make test

Step 5 :  Master configuration

a. ) /opt/redis-2.6.10/redis.conf

b. ) daemonize yes
c. ) port 6379 ( you can change it)

Step 6: Client configuration

a. ) /var/redis-2.6.10/redis.conf

b. ) daemonize yes

c. ) port 6380

d. ) slaveof Master IP 6379

Syntax : slaveof <Master Ip> <Master port no>

  Step 7 :
Now go to master server and type :

# cd /opt/redis-2.6.10/src

Step 8 :
# ./redis-server /opt/redis-2.6.10/redis.conf

Step 9 :
# ./redis-cli -p 6379

Step 10 :Then switch to slave terminal and type :

# cd /var/redis-2.6.10/src

Step 11:
# ./redis-server /var/redis-2.6.10/redis.conf

# ./redis-cli -p 6380

Step 12 :
then to check replication type :

info

Output:

Replication
role:slave
master_host:<Master IP >
master_port:6379
master_link_status:up
master_last_io_seconds_ago:3
master_sync_in_progress:0
slave_priority:100
slave_read_only:1
connected_slaves:0


So, this is how we setup redis server master- slave.
Looking forward your comments and suggestions. Thanks !    

No comments:

Post a Comment