如何保持Redis服务器运行

我在nodejs应用程序中使用redis进行会话支持。 我已经安装了Redis服务器,它运行时,我运行Redis的服务器,但是当我closuresterminal的Redis停止,并不起作用。 如何让redis服务器永久运行?

将Redis作为守护程序启动的最简单方法是编辑configuration文件并更改以下行:

# 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 

请确保在启动时在redis-server命令行上提供configuration文件。

Redis发行版中提供了configuration文件的示例。

而且,如果您想快速select,请运行: redis-server --daemonize yes

正如@DidierSpezia在他的回答中提到的,

在Redis conf文件中设置daemonize yes 。 在/path/to/redis.conf中的Redis conf文件中设置daemonize yes通常应该在/etc/

和:

然后用conf文件作为参数触发redis-server:

 ./redis-server /etc/redis.conf