Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overriding redis.conf and networking issues #420

Open
opyate opened this issue Oct 11, 2024 · 0 comments
Open

overriding redis.conf and networking issues #420

opyate opened this issue Oct 11, 2024 · 0 comments

Comments

@opyate
Copy link

opyate commented Oct 11, 2024

I'm using Redis 7.4.0 via docker compose. This repo contains no redis.conf, so presumably you use the default conf in the main repo.

I downloaded the default conf at that tag.

Then tell compose to use it:

   redis:
     image: redis:7.4.0
+    command:
+      - redis-server
+      - /usr/local/etc/redis/redis.conf
+    volumes:
+    - ./redis:/usr/local/etc/redis
+    ports:
+      - 6379:6379

However, now for some reason, I get this error from my Python app:

redis.exceptions.ConnectionError: Error 111 connecting to redis:6379. Connection refused.

I still haven't made any changes to redis.conf.

Troubleshooting

Trying to determine if the "default default" config and "supplied default" config differs:

Before compose.yml change:

docker compose exec -ti redis redis-cli config get "*" > redis/config-supplied.txt

After compose.yml change:

docker compose exec -ti redis redis-cli config get "*" > redis/config-default.txt

Some pre-processing, as the keys are unordered:

paste -d ':' - - < redis/config-supplied.txt | sort > redis/sorted-config-supplied.txt
paste -d ':' - - < redis/config-default.txt | sort > redis/sorted-config-default.txt

Lo and behold, the 2 outputs differ:

% diff  redis/sorted-config-default.txt redis/sorted-config-supplied.txt                         
28c28
< bind:* -::*
---
> bind:127.0.0.1 -::1
113c113
< pidfile:
---
> pidfile:/var/run/redis_6379.pid
117c117
< protected-mode:no
---
> protected-mode:yes

I know the PID is irrelevant w.r.t docker and daemonisation, but the bind and protected-mode configs are the breaking change here.

Commenting all binds now gives:

redis.exceptions.ConnectionError: Error 104 while writing to socket. Connection reset by peer.

Changing bind to just be bind:* -::* gives:

redis.exceptions.ConnectionError: Error -3 connecting to redis:6379. Temporary failure in name resolution.

What worked in the end was having protected-mode:no and all binds commented.

If requested, I can send a PR to the doc for the Redis Docker Hub to have the "Additionally, if you want to use your own redis.conf ..." section reflect the above guidance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant