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

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

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:

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:

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" ]

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

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

What am I doing wrong?"

<details>
<summary>英文:</summary>

I&#39;m following the steps explained here:

- https://www.docker.com/blog/how-to-use-the-redis-docker-official-image/
- https://hub.docker.com/_/redis/

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:


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" ]


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


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


What am I doing wrong?

</details>


# 答案1
**得分**: 3

看起来您正在使用Redis 7.0.9版本的`redis-server`,并且使用`redis.conf`文件的`unstable`版本。

这个版本似乎尚不支持`locale-collate`配置参数,这可能是导致出现错误的原因,因为配置文件中包含这个参数。

以下是7.0.9标签的配置文件代码,其中没有提到`locale-collate`:

https://github.com/redis/redis/blob/7.0.9/src/config.c

我建议您使用7.0.9版本的配置文件,或者如果您确实需要此参数,可以编译一个`redis-server`的不稳定版本。

以下是7.0.9的配置文件:

https://github.com/redis/redis/blob/7.0.9/redis.conf

<details>
<summary>英文:</summary>

It looks like you are using the `unstable` version of the `redis.conf` file with the Redis 7.0.9 release of `redis-server`.

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.

Here&#39;s the code for the config file for 7.0.9 tag which doesn&#39;t mention `locale-collate`:

https://github.com/redis/redis/blob/7.0.9/src/config.c

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`.

Here&#39;s the 7.0.9 config file:

https://github.com/redis/redis/blob/7.0.9/redis.conf

</details>



# 答案2
**得分**: 0

始终参考`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`中,以下部分甚至未定义。

```plaintext
# 设置用于字符串比较操作的本地环境,还会影响Lua脚本的性能。空字符串表示区域设置
# 源自环境变量。
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.

# Set the local environment which is used for string comparison operations, and
# also affect the performance of Lua scripts. Empty String indicates the locale
# is derived from the environment variables.
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:

确定