2020-01-15 Linux虚拟机后台启动redis

一、启动redis
1.前台启动

[root@iz2ze4jq06yojn4f8bm98kz redis-4.0.8]# ./src/redis-server 
19367:C 15 Jan 18:26:32.374 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
19367:C 15 Jan 18:26:32.374 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=19367, just started
19367:C 15 Jan 18:26:32.374 # Warning: no config file specified, using the default config. In order to specify a config file use ./src/redis-server /path/to/redis.conf
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 4.0.8 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 19367
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

19367:M 15 Jan 18:26:32.375 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
19367:M 15 Jan 18:26:32.375 # Server initialized
19367:M 15 Jan 18:26:32.375 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
19367:M 15 Jan 18:26:32.375 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
19367:M 15 Jan 18:26:32.375 * Ready to accept connections
^C19367:signal-handler (1579084009) Received SIGINT scheduling shutdown...
19367:M 15 Jan 18:26:49.705 # User requested shutdown...
19367:M 15 Jan 18:26:49.705 * Saving the final RDB snapshot before exiting.
19367:M 15 Jan 18:26:49.706 * DB saved on disk
19367:M 15 Jan 18:26:49.706 # Redis is now ready to exit, bye bye...

2.后台启动

[root@iz2ze4jq06yojn4f8bm98kz redis-4.0.8]# nohup ./src/redis-server &
nohup: ignoring input and appending output to ?.ohup.out?

解决:
1.查看日志:

[root@iz2ze4jq06yojn4f8bm98kz redis-4.0.8]# tail -f nohup.out
19394:C 15 Jan 18:31:38.184 # Warning: no config file specified, using the default config. In order to specify a config file use ./src/redis-server /path/to/redis.conf
19394:M 15 Jan 18:31:38.185 # Creating Server TCP listening socket *:6379: bind: Address already in use
19418:C 15 Jan 18:36:18.970 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
19418:C 15 Jan 18:36:18.970 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=19418, just started
19418:C 15 Jan 18:36:18.970 # Warning: no config file specified, using the default config. In order to specify a config file use ./src/redis-server /path/to/redis.conf
19418:M 15 Jan 18:36:18.971 # Creating Server TCP listening socket *:6379: bind: Address already in use
19420:C 15 Jan 18:37:08.698 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
19420:C 15 Jan 18:37:08.698 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=19420, just started
19420:C 15 Jan 18:37:08.698 # Warning: no config file specified, using the default config. In order to specify a config file use ./src/redis-server /path/to/redis.conf
19420:M 15 Jan 18:37:08.699 # Creating Server TCP listening socket *:6379: bind: Address already in use

好像已经启动了,但是netstat -input|grep redis 没有查到进程

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容