redis服务后台运行

文章目录

  • 进入redis的安装目录
  • 查看目录结构
  • 进入src目录,普通启动效果
  • 编辑redis服务目录下的redis.conf
  • 进入src目录,执行后台运行的命令
  • 检查服务是否开启

进入redis的安装目录

[root@qa-44 redis-2.8.13]#

查看目录结构

[root@qa-44 redis-2.8.13]#ll
total 124
-rw-rw-r-- 1 root root 22424 Jul 14  2014 00-RELEASENOTES
-rw-rw-r-- 1 root root    52 Jul 14  2014 BUGS
-rw-rw-r-- 1 root root  1439 Jul 14  2014 CONTRIBUTING
-rw-rw-r-- 1 root root  1487 Jul 14  2014 COPYING
-rw-rw-r-- 1 root root    11 Jul 14  2014 INSTALL
-rw-rw-r-- 1 root root  4223 Jul 14  2014 MANIFESTO
-rw-rw-r-- 1 root root   151 Jul 14  2014 Makefile
-rw-rw-r-- 1 root root  4404 Jul 14  2014 README
drwxrwxr-x 6 root root  4096 Aug 31  2015 deps
-rw-rw-r-- 1 root root 32215 Feb  1 02:01 redis.conf
-rwxrwxr-x 1 root root   271 Jul 14  2014 runtest
-rwxrwxr-x 1 root root   281 Jul 14  2014 runtest-sentinel
-rw-rw-r-- 1 root root  6226 Jul 14  2014 sentinel.conf
drwxrwxr-x 2 root root  4096 Feb  1 01:58 src
drwxrwxr-x 9 root root  4096 Jul 14  2014 tests
drwxrwxr-x 3 root root  4096 Jul 14  2014 utils

进入src目录,普通启动效果

[root@qa-44 redis-2.8.13]#cd src/
[root@qa-44 src]#redis-server
[3649] 01 Feb 02:06:15.900 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 2.8.13 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in stand alone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 3649
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[3649] 01 Feb 02:06:15.902 # Server started, Redis version 2.8.13
[3649] 01 Feb 02:06:16.484 * DB loaded from disk: 0.581 seconds
[3649] 01 F

发现ctrl+c,或者关闭窗口服务会停掉

编辑redis服务目录下的redis.conf

[root@qa-44 src]#cd ../
[root@qa-44 redis-2.8.13]#vi redis.conf

vi搜索(: /)如下片段

daemonize no

将no改为yes,并保存退出。

进入src目录,执行后台运行的命令

[root@qa-44 redis-2.8.13]#cd src
[root@qa-44 src]#redis-server ../redis.conf

运行完了之后,不会有任何输出

检查服务是否开启

[root@qa-44 src]#ps -ef |grep redis
root      3787     1  0 02:10 ?        00:00:00 redis-server *:6379
root      3832  2788  0 02:11 pts/0    00:00:00 grep redis

你可能感兴趣的:(#,Database,------,Redis)