Redis is a very quick key-value data storage that is often used as a distributed cache. It has a set of data-structures to keep values: strings, lists, hashes, sets, sorted sets and bitmaps.

You can easily download and install it on your local computer. Just download the latest stable version archive from the official site, extract files and execute command “make” inside extracted folder. Then run “src/redis-server”. It will start the Redis server on default port (6379).

After running command “stc/redis-cli” you can use the command-line interface.

Now let’s try to go into Redis basics and save a simple key-value pair in Redis:

> SET name bob

Redis should respond with “OK” message in console.

To retrieve back our value by its key:

> GET name

Redis should return “bob”.


Hash is a data structure that allows to keep many key-value pairs

> HSET myHash fullName James Bond

> HSET myHash age 40

Now try to retrieve values from hash by using commands:

> HGET myHash fullName

Returns value with “fullName” key

> HVALS myHash

Returns all values from my


Redis supports master-slaves replication like many other NoSQL databases. Look how easy it is to provide such replication:

  1. copy redis.conf file (in your Redis installation directory) to a new configuration file – let’s call it redis-s1.conf.
  2. make changes inside redis-s1.conf:
port 6380
slaveof 6379
  1. run “redis-server redis-s1.conf

Now you know Redis basics. Don’t forget to practice your skills.

We have got a review of free redis servers where you can pick one of 4 popular hostings to set up this DB remotely.

Leave A Comment