containers icon indicating copy to clipboard operation
containers copied to clipboard

about REDIS_RDB_POLICY

Open allegrox opened this issue 1 year ago • 4 comments

Name and Version

bitnami/redis

What architecture are you using?

amd64

What steps will reproduce the bug?

https://github.com/bitnami/containers/blob/main/bitnami/redis/README.md

The readme documentation describes setting Enable Redis(R) RDB persistence in docker-compose.yml: redis.

  ...
    environment: ...
      ...
      - REDIS_TLS_ENABLED=yes
      - REDIS_RDB_POLICY_DISABLED=no
      - REDIS_RDB_POLICY="900#1 600#5 300#10 120#50 60#1000 30#10000”
    ...
  ...

But after installing this method configuration the container fails to start with an error:

redis-1 | redis 17:34:42.20 INFO ==> ** Starting Redis **
redis-1 | redis 17:34:42:20 INFO ==> ** Starting Redis **
redis-1 | *** FATAL CONFIG FILE ERROR (Redis 6.2.14) ***
redis-1 | Reading the configuration file, at line 2055
redis-1 | >>> 'save '900 1'
redis-1 | Unbalanced quotes in configuration line
redis-1 exited with code 1

Changed to the following method to start normally - “REDIS_RDB_POLICY=900#1 600#5 300#10 120#50 60#1000 30#10000” But I found another problem, every time I restarted the container, the contents of the CONFIG GET SAVE fetch would be incremented with the contents of REDIS_RDB_POLICY, e.g.:

127.0.0.1:6379> config get save
1) "save"
2) "900 1 600 5 300 10 120 50 60 1000 30 10000 900 1 600 5 300 10 120 50 60 1000 30 10000"

How do I configure the REDIS_RDB_POLICY parameter correctly?

allegrox avatar Sep 10 '24 10:09 allegrox

Hi @allegrox, thank you for opening this issue. You are right, setting the "save" config is buggy right now. It can be set multiple times and the resulting applied configuration would be the concatenation of all of those.

To fix the issue, we should probably make the redis_conf_set a bit smarter and detect if the config param is already set in the config file. Also, I'm not really sure why the for loop is in place. Some refs:

https://github.com/bitnami/containers/blob/1a0f63f24e4fa4bc6ea3c85a2f6e258e5da6e3f7/bitnami/redis/7.4/debian-12/rootfs/opt/bitnami/scripts/libredis.sh#L416-L425 https://github.com/bitnami/containers/blob/1a0f63f24e4fa4bc6ea3c85a2f6e258e5da6e3f7/bitnami/redis/7.4/debian-12/rootfs/opt/bitnami/scripts/libredis.sh#L48-L65

Would you like to contribute with a fix for this bug? PRs are more than welcome!!

andresbono avatar Sep 23 '24 10:09 andresbono

In my understanding, $REDIS_RDB_POLICY should contain a full policy content. Then saving the policy content is a process of replacing the existing policy, so you can clear the current policy before starting. My solution is to copy the script from line 419 to just before line 422. I'll submit a pull request later.

allegrox avatar Sep 25 '24 05:09 allegrox

Thank you for opening this issue and submitting the associated Pull Request. Our team will review and provide feedback. Once the PR is merged, the issue will automatically close.

Your contribution is greatly appreciated!

carrodher avatar Sep 28 '24 17:09 carrodher

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] avatar Oct 17 '24 01:10 github-actions[bot]

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

github-actions[bot] avatar Oct 23 '24 01:10 github-actions[bot]