停止 redis 服务器.关机和停止都不起作用 [英] Stop redis server. Neither shutdown nor stop works
问题描述
我想停止 redis 服务器,它一直在运行.我正在使用 redis-2.6.7
I want to stop the redis server and it just keeps going and going. I am using redis-2.6.7
检查它是否正在运行:
redis-server
它说...绑定:地址已在使用中",所以它已经在运行.
It says "...bind: Address already in use" so it is already running.
我试过了
redis-cli
redis 127.0.0.1:6379> shutdown
它只是挂起,什么也没有发生.我打破并检查,是的,它仍在运行.
It just hangs and nothing happens. I break out and check, yes, it is still running.
我试过了
redis-server stop
我收到无法打开配置文件‘停止’"
I get "can't open config file 'stop'"
我试过了:
killall redis-server
仍在运行.
我想停止它的原因是当我尝试通过 Python 设置或获取值时它只是挂起.所以我想我会重新启动它.
The reason that I want to stop it is that it is just hanging when I try to set or get a value via Python. So I thought that I would restart it.
redis-cli 似乎没有任何命令可以工作.我也试过 INFO,它只是挂起.
No commands seem to work from redis-cli. I also tried INFO and it just hangs.
推荐答案
我终于搞定了.
获取进程的 PID(这在 Webfaction 中有效):
Get the PID of the process (this worked in Webfaction):
ps -u my_account -o pid,rss,command | grep redis
然后
> kill -9 the_pid
我能够重现这个问题:
Start redis-server
Then break it using Pause/Break key
现在挂了,不能正常关机了.尝试设置/获取密钥的 Python 程序也挂起.为避免这种情况:只需在启动 redis-server 后关闭窗口即可.现在运行正常.
Now it hangs and it won't shutdown normally. Also the Python program trying to set/get a key hangs. To avoid this: Just close the window after starting redis-server. It's now running normally.
这篇关于停止 redis 服务器.关机和停止都不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!