Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Building and Loading the ReJSON Module on Linux Ubuntu 16.04 for Redis

make sure you have at least redis v4.0+

redis-server --version

redis-cli --version

install the build-essential package

apt-get install build-essential


git clone https://github.com/RedisLabsModules/rejson.git

cd rejson/

make

cd src/

mkdir /etc/redis/modules/

mv rejson.so /etc/redis/modules/

add this line to /etc/redis/redis.conf

loadmodule /etc/redis/modules/rejson.so

restart redis server

service redis-server restart

--

ref: https://oss.redislabs.com/rejson/#linux-ubuntu-1604

@nateGeorge

This comment has been minimized.

Copy link

commented Jan 30, 2019

lifesaver

@CaypoH

This comment has been minimized.

Copy link

commented Mar 15, 2019

For CentOS:

UPDATING AND INSTALLING PACKAGES

yum update -y
yum install epel-release yum-utils -y
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
yum-config-manager --enable remi
yum install redis git -y

SETTING VARIABLES

REJSON_MODULES=$(rpm -ql redis | grep modules)  # default: /usr/lib64/redis/modules
REDIS_CONF=$(rpm -ql redis | grep "redis.conf$")  # default: /etc/redis.conf
HOST_IP=$(ip addr show eth0 | grep -Po "inet \K[\d.]+")

INSTALLING REJSON MODULE

cd /usr/src
git clone https://github.com/RedisLabsModules/rejson.git
cd rejson/
make
cp src/rejson.so ${REJSON_MODULES}
chown redis:redis ${REJSON_MODULES}/rejson.so
chmod 750 ${REJSON_MODULES}/rejson.so

CHANGING CONFIGURATION AND STARTING REDIS

sed -i "/MODULES/a loadmodule ${REJSON_MODULES}/rejson.so" ${REDIS_CONF}
sed -i "s/bind 127.0.0.1/bind ${HOST_IP}/g" ${REDIS_CONF}  # remove this line if you dont want redis server to be accessible from outside
systemctl start redis
systemctl enable redis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.