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

Redis sentinel 6.0.9 in docker: Could not create tmp config file (Permission denied) #8172

Closed
bonikforever opened this issue Dec 11, 2020 · 5 comments

Comments

@bonikforever
Copy link

Running sentinel in docker 19.03.13.
On all available 6.0.x versions I got this error when sentinel tries to create new config. And sentinel works fine with 5.x.

@oranagra
Copy link
Member

@bonikforever can you please add more details?
did you get any assertion? error? or crash log?
did you build and configure redis yourself or download it from docker hub?
could this be related to #7824 (merged into 6.0.9)? did you test an earlier version of 6.0.x?

@bonikforever
Copy link
Author

bonikforever commented Dec 13, 2020

@oranagra thank for you question!
This is what I get in log:

sentinel_1  | 1:X 13 Dec 2020 11:49:15.640 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
sentinel_1  | 1:X 13 Dec 2020 11:49:15.640 # Redis version=6.0.9, bits=64, commit=00000000, modified=0, pid=1, just started
sentinel_1  | 1:X 13 Dec 2020 11:49:15.640 # Configuration loaded
sentinel_1  | 1:X 13 Dec 2020 11:49:15.642 * Running mode=sentinel, port=26379.
sentinel_1  | 1:X 13 Dec 2020 11:49:15.642 # Could not create tmp config file (Permission denied)
sentinel_1  | 1:X 13 Dec 2020 11:49:15.642 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Permission denied

I used image from docker hub with simple config:

protected-mode no
port 26379
dir /data
sentinel monitor myredis 192.168.1.1 6379 2
sentinel down-after-milliseconds myredis 5000
sentinel parallel-syncs myredis 1
sentinel failover-timeout myredis 10000

And error raised when sentinel tries to update confg.

I couldn't say anything about C code but this error happens only in 6.0.9. In 6.0.8 and earlier it doesn't.

Command to run:

chown 999 ./sentinel.conf
docker run --rm -v $(pwd)/sentinel.conf:/usr/local/etc/redis/sentinel.conf redis:6.0.9 redis-server /usr/local/etc/redis/sentinel.conf --sentinel

@bonikforever bonikforever changed the title Redis sentinel 6.x in docker: Could not create tmp config file (Permission denied) Redis sentinel 6.0.9 in docker: Could not create tmp config file (Permission denied) Dec 13, 2020
yossigo added a commit to yossigo/docker-library-docs that referenced this issue Dec 13, 2020
The provided example may be misleading and will not work in certain
scenarios, where Redis attempts to create additional configuration files
or rewrite existing ones.

See redis/redis#8172.
@yossigo
Copy link
Member

yossigo commented Dec 13, 2020

Hi @bonikforever, thanks for reporting this. This is a result of a bugfix that introduced a regression when the directory where the configuration file resides cannot be written to (which is more or less the case with a single file bindmount).

You can work around this easily by bind mounting the entire directory. For example:

mkdir -p ${PWD}/sentinel_conf
chmod -R 0777 ${PWD}/sentinel_conf
docker run -v ${PWD}/sentinel_conf:/usr/local/etc/redis redis:6.0.9 redis-server /usr/local/etc/redis/sentinel.conf --sentinel

yossigo added a commit to yossigo/docker-library-docs that referenced this issue Dec 13, 2020
The provided example may be misleading and will not work in certain
scenarios, where Redis attempts to create additional configuration files
or rewrite existing ones.

See redis/redis#8172.
@bonikforever
Copy link
Author

@yossigo you right, directory with config must be writable.

@yossigo yossigo closed this as completed Dec 14, 2020
@fclever1122
Copy link

I have just encountered the same problem. The error report in the log is the same. Thank you for your answer and solved my problem. @yossigo

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

4 participants