top of page

Redis Module

Redis modules are dynamic libraries that can be loaded into Redis when it boots up or by using the MODULE LOAD command.

We can extend the functionality or features of Redis by using a variety of different Redis modules. We will learn how to install and manage one of Redis module i.e RedisJSON in this blog.

Subsequently, there are numerous Redis modules available. Redis JSON support is provided by the RedisJSON module. RedisJSON is a Redis database plugin that allows you to store, update, and retrieve JSON values.

  • Download RedisJSON source and build

1. Download the source code from the official RedisJSON GitHub repository.

[root@siddhesh ~]# git clone --recursive
Cloning into 'RedisJSON'...
remote: Enumerating objects: 7828, done.
remote: Counting objects: 100% (991/991), done.
remote: Compressing objects: 100% (316/316), done.
remote: Total 7828 (delta 790), reused 776 (delta 669), pack-reused 6837
Receiving objects: 100% (7828/7828), 9.58 MiB | 0 bytes/s, done.
Resolving deltas: 100% (4850/4850), done.
Submodule 'deps/readies' ( registered for path 'deps/readies'
Cloning into 'deps/readies'...
remote: Enumerating objects: 3918, done.
remote: Counting objects: 100% (1624/1624), done.
remote: Compressing objects: 100% (461/461), done.
remote: Total 3918 (delta 1240), reused 1472 (delta 1139), pack-reused 2294
Receiving objects: 100% (3918/3918), 620.00 KiB | 0 bytes/s, done.
Resolving deltas: 100% (2666/2666), done.
Submodule path 'deps/readies': checked out 'd3ba34ee2188eaaba3156e0703398b86ed80e5d4'
[root@siddhesh ~]# cd /root/RedisJSON/

2. Install RedisJSON dependencies

[root@siddhesh RedisJSON]# ./sbin/setup
# readies version: d3ba34e
yum install -q -y ca-certificates
yum install -q -y curl wget unzip
yum install -q -y git unzip rsync
/root/RedisJSON/RedisJSON/deps/readies/bin/getclang --modern
/root/RedisJSON/RedisJSON/deps/readies/bin/getcmake --usr
yum install -q -y redhat-lsb-core
/root/RedisJSON/RedisJSON/deps/readies/bin/getgcc --modern
dir=$(mktemp -d /tmp/tar.XXXXXX); (cd $dir; wget --no-verbose -O tar.tgz; tar -xzf tar.tgz -C /; ); rm -rf $dir
yum install -q -y lcov
/root/.pyenv/versions/3.9.16/bin/python3 /root/RedisJSON/RedisJSON/deps/readies/bin/getrmpytools --reinstall --modern
/root/.pyenv/versions/3.9.16/bin/python3 -m pip install --disable-pip-version-check --user  -r /root/RedisJSON/RedisJSON/tests/pytest/requirements.txt
NO_PY2=1 /root/RedisJSON/RedisJSON/deps/readies/bin/getpudb
[root@siddhesh RedisJSON]# 

3. Build RedisJSON module. Note: Your server should have a make version greater than 3. Otherwise, you may encounter an error similar to the one shown below while building.

[root@siddhesh RedisJSON]# make build
deps/readies/mk/main:6: *** GNU Make version is too old. Aborting..  Stop.
[root@siddhesh RedisJSON]#

Check make version :

[root@siddhesh RedisJSON]# make -v
GNU Make 4.1
Built for x86_64-unknown-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[root@siddhesh RedisJSON]# 

Build RedisJSON:

[root@siddhesh RedisJSON]# make build
warning: the cargo feature `edition2021` has been stabilized in the 1.56 release and is no longer necessary to be listed in the manifest
  See for more information about using this feature.
    Updating index
  Downloaded num-integer v0.1.45
  Downloaded bitflags v1.3.2
Finished release [optimized + debuginfo] target(s) in 1m 42s
[root@siddhesh RedisJSON]#

4. Load the RdisJSON module to Redis Now we'll load the RedisJSON module in the Redis configuration file. First copy compiled module under /etc/ so that Redis will have access to it.

[root@siddhesh RedisJSON]# cp -pav /root/RedisJSON/RedisJSON/bin/linux-x64-release/target/release/ /etc/
‘/root/RedisJSON/RedisJSON/bin/linux-x64-release/target/release/’ -> ‘/etc/’
[root@siddhesh RedisJSON]#

Add the below line under /etc/redis.conf and restart Redis Service to take these change effect.

[root@siddhesh RedisJSON]# grep /etc/redis.conf 
loadmodule /etc/
[root@siddhesh RedisJSON]# systemctl restart redis

5. Verify the Loaded Module. Connect to Redis and run the command below to view the details of loaded modules.

[root@siddhesh RedisJSON]# redis-cli> module list
1) 1) "name"
   2) "ReJSON"
   3) "ver"
   4) (integer) 999999
   5) "path"
   6) "/etc/"
   7) "args"
   8) (empty array)> 

bottom of page