如何保持Redis服务器运行 [英] How to keep redis server running

查看:61
本文介绍了如何保持Redis服务器运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 nodejs 应用程序中使用 redis 来支持会话.我已经安装了 redis 服务器,当我运行 redis-server 时它可以工作,但是当我关闭终端时 redis 停止并且不起作用.关闭终端后如何保持redis服务器运行?

I am using redis for session support in nodejs app. I have installed redis server and it works when I run redis-server, but when I close terminal redis stops and does not work. How do I keep redis server running after closing the terminal?

推荐答案

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

The easiest way to launch Redis as a daemon is to edit the configuration file and change the following line:

# 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 命令行上提供配置文件.

Be sure to provide the configuration file on the redis-server command line when you launch it.

Redis 发行版中提供了一个配置文件示例.

An example of configuration file is provided in the Redis distribution.

这篇关于如何保持Redis服务器运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆