Linux 后台启动 Redis

1. 修改 redis.conf

首先,这里有一个坑 !

不同的 redis版本,在安装的时候,redis.conf 的路径稍微有些不同

redis.conf 可能出现的三个位置:

  • /etc/redis.conf
  • /redis/src/redis.conf
  • /redis/redis.conf

redis.conf配置文件中daemonize守护线程,默认是NO,daemonize是用来指定redis是否要用守护线程的方式启动

daemonize yes : redis采用的是单进程多线程的模式。当redis.conf中选项daemonize设置成yes时,代表开启守护进程模式。在该模式下,redis会在后台运行,并将进程pid号写入至redis.conf选项pidfile设置的文件中,此时redis将一直运行,除非手动kill该进程。
daemonize no :当daemonize选项设置成no时,当前界面将进入redis的命令行界面,exit强制退出或者关闭连接工具(putty,xshell等)都会导致redis进程退出。
 
 

2. 执行后台启动命令

./redis-server redis.conf
原文地址:https://www.cnblogs.com/beiyi888/p/13329536.html