Activities

August 2015
M T W T F S S
« Jul   Sep »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Installing redis on CentOS6 / RHEL6 server

Redis is what is called a key-value store, often referred to as a NoSQL database. The essence of a key-value store is the ability to store some data, called a value, inside a key. This data can later be retrieved only if we know the exact key used to store it. We can use the command SET to store the value “fido” at key “server:name”:

SET server:name "liju"

Redis will store our data permanently, so we can later ask “What is the value stored at key server:name?” and Redis will reply with “fido”:

 GET server:name => "liju"

Here is the quick command to install it on latest Amazon AMI or CentOS 6 linux distribution.

1. Installing redis package from Remi Fedora repository

[root@birla_web01 installation]# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.lNIECX: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:epel-release-6-8                 ################################# [100%]
[root@birla_web01 installation]# rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-6.rpm
Retrieving http://rpms.remirepo.net/enterprise/remi-release-6.rpm
warning: /var/tmp/rpm-tmp.iu4RbA: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:remi-release-6.6-1.el6.remi      ################################# [100%]

2. Installing Redis

[root@birla_web01 installation]# yum --enablerepo=remi,remi-test install redis
Resolving Dependencies
--> Running transaction check
---> Package redis.x86_64 0:3.0.3-1.el6.remi will be installed
--> Processing Dependency: libjemalloc.so.1()(64bit) for package: redis-3.0.3-1.el6.remi.x86_64
--> Running transaction check
---> Package jemalloc.x86_64 0:3.3.1-1.8.amzn1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================
 Package              Arch               Version                      Repository             Size
==================================================================================================
Installing:
 redis                x86_64             3.0.3-1.el6.remi             remi                  431 k
Installing for dependencies:
 jemalloc             x86_64             3.3.1-1.8.amzn1              amzn-main             111 k
Transaction Summary
==================================================================================================
Install  1 Package (+1 Dependent package)
Total download size: 542 k
Installed size: 1.3 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): jemalloc-3.3.1-1.8.amzn1.x86_64.rpm                                 | 111 kB     00:00
warning: /var/cache/yum/x86_64/latest/remi/packages/redis-3.0.3-1.el6.remi.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Public key for redis-3.0.3-1.el6.remi.x86_64.rpm is not installed
(2/2): redis-3.0.3-1.el6.remi.x86_64.rpm                                   | 431 kB     00:00
--------------------------------------------------------------------------------------------------
Total                                                             492 kB/s | 542 kB  00:00:01
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Importing GPG key 0x00F97F56:
 Userid     : "Remi Collet <RPMS@FamilleCollet.com>"
 Fingerprint: 1ee0 4cce 88a4 ae4a a29a 5df5 004e 6f47 00f9 7f56
 Package    : remi-release-6.6-1.el6.remi.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : jemalloc-3.3.1-1.8.amzn1.x86_64                                                1/2
  Installing : redis-3.0.3-1.el6.remi.x86_64                                                  2/2
  Verifying  : redis-3.0.3-1.el6.remi.x86_64                                                  1/2
  Verifying  : jemalloc-3.3.1-1.8.amzn1.x86_64                                                2/2
Installed:
  redis.x86_64 0:3.0.3-1.el6.remi
Dependency Installed:
  jemalloc.x86_64 0:3.3.1-1.8.amzn1
Complete!

3. Starting redis service and added it in system startup services

[root@birla_web01 installation]# /etc/init.d/redis start
Starting redis-server:                                     [  OK  ]
[root@birla_web01 installation]# chkconfig redis on
[root@birla_web01 installation]#

How do I verify that redis is running and working as expected

Redis using stand port 6379

[root@birla_web01 installation]# netstat -nlp | grep  "6379"
tcp        0      0 127.0.0.1:6379              0.0.0.0:*                   LISTEN      23698/redis-server
[root@birla_web01 installation]#

Verifying functionality

[root@birla_web01 installation]# redis-cli ping
PONG
[root@birla_web01 installation]#

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>