If Redis is started from a Docker container, the Redis Redisearch module cannot be started simultaneously during container startup. It needs to be loaded into the container after startup using the command MODULE LOAD /usr/lib/redis/modules/redisearch.so.
When performing data persistence, suppose a new container is started using the following command, and the container mounts the data in the /home/redis/data4 folder on the host:
docker run -p 6379:6379 --name redisnewdata3 -v /home/redis/data4:/data -v /home/redis/conf/redis.conf:/etc/redis/redis.conf -d docker.io/redislabs/redisearch --appendonly yes --requirepass abc123456
If the /home/redis/data4 folder contains any Redisearch commands in the appendonly.aof file, such as "FT.CREATE myindex ON HASH SCHEMA reminder TEXT", the entire container will fail to start because the "redisearch" module cannot be loaded and the data in the "appendonly.aof" file cannot be recovered. Even if the container is started and the redisearch module is loaded first, replacing the data in the /home/redis/data4 folder will still result in the data not being loaded and recovered properly.
In other words, if the data file contains any commands associated with modules like Redisearch and RediJSON, Docker containers will not be able to recover the data from the 'appendonly.aof' file because the modules cannot be loaded during container startup. This inability to load the modules will result in the container failing to start correctly, causing a deadlock. The container startup logs will display the following error: Unknown command 'FT._CREATEIFNX' reading the append only file.
Similarly, if the data recovery is changed to an RDB file, the container startup will also fail to start correctly because it cannot recognize the AUX.
I am eagerly awaiting your response and hope that you continue to improve.
Comment From: zuiderkwast
A module can be loaded at startup using config file. Have you tried that? See comment here: https://github.com/redis/redis/blob/unstable/redis.conf#L47
Comment From: nb001
I tried this and used this prompt: "loadmodule /usr/lib/redis/modules/redisearch.so" in my redis.conf , but it doesn't work, when the docker container started, the module can't be loaded. So on this situation, we should mount the redisearch module by hands. After doing this, if we use the appendonly.aof files which include the "FT.CREATE myindex ON HASH SCHEMA reminder TEXT" replace the initial one, that can't be reloaded. Could you help me find another way to slove this? Thank you very much.
Comment From: haysch
Hi,
Sorry to barge in, but I see the image that you point to is redislabs/redisearch.
Is this intentional? The image is defined as deprecated on hub.docker.com.
Anyhow, is it possible for you to provide a log of container? It could help navigate the startup sequence.