Skip to content

Instantly share code, notes, and snippets.

@lmj0011
Last active August 30, 2023 05:50
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save lmj0011/820eea392f6f43c755fadc2ba56b69e9 to your computer and use it in GitHub Desktop.
Save lmj0011/820eea392f6f43c755fadc2ba56b69e9 to your computer and use it in GitHub Desktop.
Building and Loading the ReJSON v1 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/RedisJSON/RedisJSON.git

git checkout v1.0.3

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

@codewithkushagra
Copy link

--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-.so', 'libclang.so.', 'libclang-.so.'], set the LIBCLANG_PATH environment variable to a path where one of these files can be found (invalid: [])"', /home/kushagra/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.59.2/src/lib.rs:2144:31
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
make: *** [Makefile:166: build] Error 10

I am getting this, when I enter the make command??

@lmj0011
Copy link
Author

lmj0011 commented Jan 22, 2022

@codewithkushagra

Trying doing git checkout v1.0.3, and then running the make command again. (updated the instructions)

This gist hasn't been tested for RedisJSON v2+

@binkabir
Copy link

this works for me.
##install redisJson on 20.04

git clone https://github.com/RedisJSON/RedisJSON.git
cd RedisJSON
cargo build --release
cd target/release/
mkdir /etc/redis/modules/
mv librejson.so /etc/redis/modules/

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

loadmodule /etc/redis/modules/librejson.so
service redis-server restart

@rkrishd
Copy link

rkrishd commented May 25, 2022

sudo yum --enablerepo=remi install redis
yum install clang clang-devel -y
yum install centos-release-scl -y
yum install devtoolset-7-gcc* -y
yum install devtoolset-7-make -y
scl enable devtoolset-7 bash
yum install llvm-toolset-7 -y
scl enable llvm-toolset-7 bash
curl https://sh.rustup.rs -sSf | sh
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.]+")
cd /usr/src
git clone https://github.com/RedisLabsModules/rejson.git
cd rejson/
make
cp ./bin/linux-x64-release/rejson.so ${REJSON_MODULES}
chown redis:redis ${REJSON_MODULES}/rejson.so
chmod 750 ${REJSON_MODULES}/rejson.so
sed -i "/MODULES/a loadmodule ${REJSON_MODULES}/rejson.so" ${REDIS_CONF}
systemctl start redis
systemctl enable redis

@csharpnewbie3
Copy link

While checking out I am not able to use the latest RedisJson version. Will the steps change in that case? Can someone help? I am using 16.04 Ubuntu. When checking out the version mentioned its working fine but not in case of latest version.

@tausifcreates
Copy link

Hello people, who are having problems. Download the latest release tarball from here:
wget https://github.com/RedisJSON/RedisJSON/archive/refs/tags/v2.0.9.tar.gz

Then run cargo build --release from the root path.

@sasthrajyothi
Copy link

this works for me. ##install redisJson on 20.04

git clone https://github.com/RedisJSON/RedisJSON.git
cd RedisJSON
cargo build --release
cd target/release/
mkdir /etc/redis/modules/
mv librejson.so /etc/redis/modules/

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

loadmodule /etc/redis/modules/librejson.so
service redis-server restart

@sasthrajyothi
Copy link

can you please tell me how to know the path to load the the module

@tausifcreates
Copy link

can you please tell me how to know the path to load the the module

You can find librejson.so in release folder under build

@britisharmy
Copy link

@akshaysaini11
Copy link

please provide same as redis search install in Linux/Ubuntu
kindly provide commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment