想在后台不间断地运行 redis-server [英] want to run redis-server in background nonstop
问题描述
我已经下载了 redis-2.6.16.tar.gz 文件并且安装成功.安装后我运行 src/redis-server 它工作正常.
I have downloaded redis-2.6.16.tar.gz file and i installed sucessfully. After installed i run src/redis-server it worked fine.
但我不想每次都手动运行 src/redis-server,而是希望 redis-server 作为后台进程持续运行.
But i don't want manually run src/redis-server everytime, rather i want redis-server running as background process continuously.
到目前为止,安装后我做了以下任务:
So far after installed i did following tasks:
1.vim redis.conf 和我改成
1. vim redis.conf and i changed to
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes
但我发现了同样的结果.我犯了什么错误?
But same result i found. What mistake i did?
redis 后台运行后.我还将使用以下命令将 juggernaut 作为后台进程运行.
After redis run in background. I will run juggernaut also as background process with following command.
nohup node server.js
但是我无法让 redis 在后台运行.请提供一些解决方案.
But i am not able to make redis run in background. Please provide some solution.
推荐答案
从 Redis 2.6 开始,可以直接使用命令行传递 Redis 配置参数.这对于测试目的非常有用.
Since Redis 2.6 it is possible to pass Redis configuration parameters using the command line directly. This is very useful for testing purposes.
redis-server --daemonize yes
检查进程是否启动:
ps aux | grep redis-server
这篇关于想在后台不间断地运行 redis-server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!