Docker化的Redis版本存在配置问题。

huangapple go评论86阅读模式
英文:

Dockerized version of Redis has a problem of configuration

问题

以下是您要翻译的部分:

"I'm following the steps explained here:

I have a docker-compose.yml file like this:

  1. version: '3'
  2. services:
  3. backend:
  4. build: server/
  5. image: cno/api
  6. environment:
  7. NODE_ENV: "production"
  8. ports:
  9. - "9114:9114"
  10. networks:
  11. - cnonetwork
  12. extra_hosts:
  13. - "host.docker.internal:host-gateway"
  14. depends_on:
  15. - redis
  16. redis:
  17. build: redis/
  18. image: cno/redis
  19. networks:
  20. - cnonetwork
  21. frontend:
  22. build: client/
  23. image: cno/client
  24. networks:
  25. - cnonetwork
  26. rp:
  27. build: reverse-proxy/
  28. image: cno/rp
  29. depends_on:
  30. - frontend
  31. - backend
  32. ports:
  33. - "80:80"
  34. networks:
  35. - cnonetwork
  36. networks:
  37. cnonetwork:

And my Dockerfile of Redis is here:

  1. FROM redis
  2. COPY redis.conf /usr/local/etc/redis/redis.conf
  3. CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]

The redis.conf being the same suggested in the documentation (https://github.com/redis/redis/blob/unstable/redis.conf). My container exits with this error:

  1. *** FATAL CONFIG FILE ERROR (Redis 7.0.9) ***
  2. Reading the configuration file, at line 415
  3. >>> 'locale-collate ""'
  4. Bad directive or wrong number of arguments

I have the same error when I change the config file:

  1. *** FATAL CONFIG FILE ERROR (Redis 7.0.9) ***
  2. Reading the configuration file, at line 415
  3. >>> 'locale-collate "en_US.UTF-8"'
  4. Bad directive or wrong number of arguments
  5. What am I doing wrong?"
  6. <details>
  7. <summary>英文:</summary>
  8. I&#39;m following the steps explained here:
  9. - https://www.docker.com/blog/how-to-use-the-redis-docker-official-image/
  10. - https://hub.docker.com/_/redis/
  11. I have a `docker-compose.yml` file like this:

version: '3'

services:

backend:
build: server/
image: cno/api
environment:
NODE_ENV: "production"
ports:
- "9114:9114"
networks:
- cnonetwork
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
- redis

redis:
build: redis/
image: cno/redis
networks:
- cnonetwork

frontend:
build: client/
image: cno/client
networks:
- cnonetwork

rp:
build: reverse-proxy/
image: cno/rp
depends_on:
- frontend
- backend
ports:
- "80:80"
networks:
- cnonetwork

networks:
cnonetwork:

  1. And my `Dockerfile` of Redis is here:

FROM redis
COPY redis.conf /usr/local/etc/redis/redis.conf
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]

  1. The `redis.conf` being the same suggested in the documentation (https://github.com/redis/redis/blob/unstable/redis.conf). My container exits with this error:

*** FATAL CONFIG FILE ERROR (Redis 7.0.9) ***
Reading the configuration file, at line 415
>>> 'locale-collate ""'
Bad directive or wrong number of arguments

  1. I have the same error when I change the config file:

*** FATAL CONFIG FILE ERROR (Redis 7.0.9) ***
Reading the configuration file, at line 415
>>> 'locale-collate "en_US.UTF-8"'
Bad directive or wrong number of arguments

  1. What am I doing wrong?
  2. </details>
  3. # 答案1
  4. **得分**: 3
  5. 看起来您正在使用Redis 7.0.9版本的`redis-server`,并且使用`redis.conf`文件的`unstable`版本。
  6. 这个版本似乎尚不支持`locale-collate`配置参数,这可能是导致出现错误的原因,因为配置文件中包含这个参数。
  7. 以下是7.0.9标签的配置文件代码,其中没有提到`locale-collate`
  8. https://github.com/redis/redis/blob/7.0.9/src/config.c
  9. 我建议您使用7.0.9版本的配置文件,或者如果您确实需要此参数,可以编译一个`redis-server`的不稳定版本。
  10. 以下是7.0.9的配置文件:
  11. https://github.com/redis/redis/blob/7.0.9/redis.conf
  12. <details>
  13. <summary>英文:</summary>
  14. It looks like you are using the `unstable` version of the `redis.conf` file with the Redis 7.0.9 release of `redis-server`.
  15. This version does not yet appear to support the `locale-collate` configuration parameter, which is probably why it errors when faced with a config file that contains this.
  16. Here&#39;s the code for the config file for 7.0.9 tag which doesn&#39;t mention `locale-collate`:
  17. https://github.com/redis/redis/blob/7.0.9/src/config.c
  18. I&#39;d advise using the 7.0.9 version of the config file, or if you really need this parameter then compile an unstable version of `redis-server`.
  19. Here&#39;s the 7.0.9 config file:
  20. https://github.com/redis/redis/blob/7.0.9/redis.conf
  21. </details>
  22. # 答案2
  23. **得分**: 0
  24. 始终参考`https://github.com/redis/redis/blob/<redis_version>/redis.conf`。例如,如果您使用的是7.0.11,请参考`https://github.com/redis/redis/blob/7.0.11/redis.conf`。在`7.0.11`中,以下部分甚至未定义。
  25. ```plaintext
  26. # 设置用于字符串比较操作的本地环境,还会影响Lua脚本的性能。空字符串表示区域设置
  27. # 源自环境变量。
  28. locale-collate ""
英文:

Always refer to https://github.com/redis/redis/blob/&lt;redis_version&gt;/redis.conf. For example if you are using 7.0.11 refer to https://github.com/redis/redis/blob/7.0.11/redis.conf. In 7.0.11 the following section is not even defined.

  1. # Set the local environment which is used for string comparison operations, and
  2. # also affect the performance of Lua scripts. Empty String indicates the locale
  3. # is derived from the environment variables.
  4. locale-collate &quot;&quot;

huangapple
  • 本文由 发表于 2023年3月7日 21:19:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/75662490.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定