Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Explicitly define sentinel's pidfile #40

Closed
wants to merge 1 commit into from

Conversation

quixoten
Copy link
Contributor

Before this change, the redis-sentinel process was writing its pid to
/var/run/redis.pid, preventing the init.d scripts for correctly
identifying in stop and status calls. Tested on redis 3.0.4.

Before this change, the redis-sentinel process was writing its pid to
`/var/run/redis.pid`, preventing the init.d scripts for correctly
identifying in stop and status calls. Tested on redis 3.0.4.
@dwerder
Copy link
Member

dwerder commented Oct 13, 2015

Are you sure about that? The pidfile path is already set in the init.d scripts. Which distro do you use?

@quixoten
Copy link
Contributor Author

I'm testing on Ubuntu 14.04.3. Below is the step-by-step I used to reproduce the error.

TL;DR When the pidfile directive is absent, redis-sentinel creates the pid file in /var/run/redis.pid, when the pidfile directive is present, redis-sentinel creates the pid file in /var/run/redis-sentinel_main.pid

Test1: No pidfile directive in the config

root@redis3:~# cat /etc/redis-sentinel_main.conf 
# redis sentinel server conf

# !!! generated by puppet !!!

daemonize yes
logfile "/var/log/redis-sentinel_main.log"
port 26379

# monitor master1
sentinel monitor master1 x.x.x.80 6379 2
sentinel config-epoch master1 5
sentinel leader-epoch master1 1
sentinel known-slave master1 x.x.x.82 6379

# Generated by CONFIG REWRITE
dir "/"
sentinel known-slave master1 x.x.x.81 6379
sentinel known-sentinel master1 x.x.x.80 26379 88971965100caf31ffbff7d8b85f5c2dee9d20d7
sentinel known-sentinel master1 x.x.x.81 26379 6a829a8558221fdaa789146c6e463cde8b3f97da
sentinel current-epoch 5
root@redis3:~# service redis-sentinel_main start
 * Starting redis-sentinel_main
   ...done.
root@redis3:~# stat /var/run/redis-sentinel_main.pid
stat: cannot stat ‘/var/run/redis-sentinel_main.pid’: No such file or directory
root@redis3:~# stat /var/run/redis.pid
  File: ‘/var/run/redis.pid’
  Size: 6           Blocks: 8          IO Block: 4096   regular file
Device: 10h/16d Inode: 274115      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2015-10-13 11:55:22.553249408 -0600
Modify: 2015-10-13 11:55:22.553249408 -0600
Change: 2015-10-13 11:55:22.553249408 -0600
 Birth: -

Test2: pidfile directive added to the config.

root@redis3:~# pkill redis-sentinel
root@redis3:~# cat /etc/redis-sentinel_main.conf 
# redis sentinel server conf

# !!! generated by puppet !!!

daemonize yes
logfile "/var/log/redis-sentinel_main.log"
pidfile "/var/run/redis-sentinel_main.pid"
port 26379

# monitor master1
sentinel monitor master1 x.x.x.80 6379 2
sentinel config-epoch master1 5
sentinel leader-epoch master1 1
sentinel known-slave master1 x.x.x.82 6379

# Generated by CONFIG REWRITE
dir "/"
sentinel known-slave master1 x.x.x.81 6379
sentinel known-sentinel master1 x.x.x.80 26379 88971965100caf31ffbff7d8b85f5c2dee9d20d7
sentinel known-sentinel master1 x.x.x.81 26379 6a829a8558221fdaa789146c6e463cde8b3f97da
sentinel current-epoch 5
root@redis3:~# service redis-sentinel_main start
 * Starting redis-sentinel_main
   ...done.
root@redis3:~# stat /var/run/redis-sentinel_main.pid
  File: ‘/var/run/redis-sentinel_main.pid’
  Size: 6           Blocks: 8          IO Block: 4096   regular file
Device: 10h/16d Inode: 274391      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2015-10-13 12:01:17.798173250 -0600
Modify: 2015-10-13 12:01:17.798173250 -0600
Change: 2015-10-13 12:01:17.798173250 -0600
 Birth: -
root@redis3:~# stat /var/run/redis.pid
stat: cannot stat ‘/var/run/redis.pid’: No such file or directory

@quixoten
Copy link
Contributor Author

Anything I can do to help move this forward?

@dwerder
Copy link
Member

dwerder commented Oct 17, 2015

PR was reopened against develop branch. See #44 and DEVELOP.md
It will be merged as soon as CI is green. Thanks for the patch

@dwerder dwerder closed this Oct 17, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants