【发布时间】:2022-07-07 01:44:48
【问题描述】:
我想在 Redis 中存储 json 类型,所以我设置为使用带有 docker-compose 的 RedisJSON 模块。但是,我一直无法运行它。代码如下。 我也尝试使用填充了与命令相同的参数的 redis.conf,但是发生了分段错误。 我这步怎么了?
docker-compose.yml
version: '3.8'
services:
redis:
container_name: redis
hostname: redis
image: redis:7.0.0-alpine
command: redis-server --loadmodule /etc/redis/modules/rejson.so
volumes:
- /etc/redis/redis.conf:/etc/redis/redis.conf
- /etc/redis/modules/rejson.so:/etc/redis/modules/rejson.so
环境
Node.js 版本:16.14.1
节点 Redis 版本:4.0.6
平台:Mac OS 12.3.1
已编辑
分段错误是由于不存在的includes 选项。
重复以下消息。
执行格式错误是什么意思?
# oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
# Redis version=7.0.0, bits=64, commit=00000000, modified=0, pid=1, just started
# Configuration loaded
* monotonic clock: POSIX clock_gettime
# Warning: Could not create server TCP listening socket ::1:6380: bind: Address not available
* Running mode=standalone, port=6380.
# Server initialized
# Module /etc/redis/modules/rejson.so failed to load: Error loading shared library /etc/redis/modules/rejson.so: Exec format error
# Can't load module from /etc/redis/modules/rejson.so: server aborting
【问题讨论】:
-
除了分段错误之外,您还有关于错误的更多信息吗?也许将其粘贴到问题中?
-
我意识到这是因为机器类型不匹配。我在 ubuntu:amd64 中制作了 rejson.so,但我的 redis 服务器在 ubuntu:x86 上运行...我通过更改 redis 服务器机器类型解决了这个问题。感谢您的关注和回答!
标签: docker-compose redis