Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

/var/run/redis/redis.pid exists, process is already running or crashed

Tags:

redis

crash

Redis went quite on me.

user@mycomputer:~$ redis-cli

Could not connect to Redis at 127.0.0.1:6379: Connection refused

I try to restart the service by doing this

sudo /etc/init.d/redis_6379 stop

/var/run/redis/redis.pid exists, process is already running or crashed

But no luck. Logs didn't show an error as well.

like image 277
Tariq Khan Avatar asked Aug 24 '15 08:08

Tariq Khan


4 Answers

Got it fixed by backing up the redis.rdp file mine is located at

/var/lib/redis

check your config file "/etc/redis/redis.conf" for the rdp file's location and do this

sudo mv /var/lib/redis/redis.rdp /var/lib/redis/redis_backup.rdp

Then recreate the the redis.rdp file

sudo touch redis.rdp

Run the redis-server with the conf and it should work

 sudo redis-server /etc/redis/redis.conf
like image 162
Tariq Khan Avatar answered Nov 20 '22 16:11

Tariq Khan


Get it fixed in a tidy way: Recreate the the redis.rdp file as suggested here in one of answer, will purge all the cache recorded so far and redis will start up fresh with no cache data.

This is a warning message to notify system crash / improper shutdown: "/var/run/redis/redis.pid exists, process is already running or crashed"

Just delete /var/run/redis/redis.pid file and restart the server again.

Note: You might have lost latest cache changes due to untidy shutdown, which weren't flushed into the disk. This data loss can be minimized using frequent disk flush configuration in redis conf file(in my case it is @/etc/redis/6379.conf)

save 900 1
save 300 10
save 60 10000
Or try AOF persistence, more details [here][1]
like image 38
Ritesh K Avatar answered Nov 20 '22 18:11

Ritesh K


Run the redis-server with config.

sudo redis-server redis.conf
like image 29
xiaoyy Avatar answered Nov 20 '22 17:11

xiaoyy


Depends on how you installed redis, the pid can be found on /var/run/redis_6379.pid.

What happened is that redis crashed, but the pid is still there. So you just have to delete it.

sudo rm -f /var/run/redis_6379.pid

Then start redis again:

sudo /etc/init.d/redis_6379 start

If you can't find it, I suggest installing redis "more properly". Follow redis quickstart guide in the Installing Redis more properly section.

You can find it here: https://redis.io/topics/quickstart

like image 2
meow2x Avatar answered Nov 20 '22 16:11

meow2x