Introduction to Redis

October 1, 2017    Redis

Redis is an in-memory data structure store which can be used as database, cache or message broker.


Redis is in-memory data structure store.

Can be used as:

  • Database
  • Cache
  • Message Broker


  • Data structures (strings, hashes, lists, sets, sorted sets with range queries)
  • Bitmaps
  • Hyperloglogs
  • Geospatial indexes with radius queries


  • Built-in replication
  • Lua scripting
  • LRU eviction
  • Transactions
  • On-disk persistence
  • High availability via Redis Sentinel and automatic partitioning with Redis Cluster

Installation on CentOS 6.9

Install necessary packages

sudo yum -y install wget make gcc tcl

Redis installation

cd /tmp/

tar zxvf redis-3.2.6.tar.gz
cd redis-3.2.6

make test
sudo make install

cd utils
# redis executable path - enter this path - /usr/local/bin/redis-server
sudo ./

Verifying installation

# redis info
redis-cli info

# testing
redis-cli ping

Configuring redis

sudo vim /etc/sysctl.conf

# apply changes without restarting server
sudo sysctl vm.overcommit_memory=1

Starting redis on system restart

sudo chkconfig --add redis_6379


Redis docker instance

Downloading redis image

docker pull redis:4.0.2

Running a redis container

docker run --name redis-6379 -p 6379:6379 -d redis:4.0.2

Connect to it from an application

docker run --name some-app --link some-redis:redis -d application-that-uses-redis