Linux – Unable to load redis module, Redis JSON

Unable to load redis module, Redis JSON… here is a solution to the problem.

Unable to load redis module, Redis JSON

After following the specified instructions here Compile the source code of RedisJson, get the rejson.so file in project_root/target/release, and then I enter the command sudo redis-server –loadmodule/home/username/RedisJSON/target/release/rejson.so to load the redis module. But I got this error message.

Server initialized
7666:M 14 Sep 2021 13:27:38.795 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
7666:M 14 Sep 2021 13:27:38.795 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
7666:M 14 Sep 2021 13:27:38.862 * <ReJSON> Exported RedisJSON_V1 API
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/redis-module-0.23.0/src/raw.rs:580:42
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
Aborted

How can I solve this problem?

Solution

Redis JSON requires Redis 6+, and it looks like you’re running an older version of Redis.

Related Problems and Solutions