Home >Database >Redis >How to restart redis

How to restart redis

藏色散人
藏色散人Original
2019-07-06 14:03:4132801browse

How to restart redis

How to restart redis?

Normal startup command:

redis-server  # 启动redis服务端
[1709] 28 Feb 06:45:08.346 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[1709] 28 Feb 06:45:08.348 * Max number of open files set to 10032
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 2.8.4 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in stand alone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1709
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               
[1709] 28 Feb 06:45:08.349 # Server started, Redis version 2.8.4
[1709] 28 Feb 06:45:08.349 # 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.
[1709] 28 Feb 06:45:08.349 * The server is now ready to accept connections on port 6379

Start redis client

redis-cli 
127.0.0.1:6379>

If redis is installed using apt-get or yum install, you can directly stop/start/restart redis through the following commands

/etc/init.d/redis-server stop
/etc/init.d/redis-server start
/etc/init.d/redis-server restart

Note: Use /etc/ The init.d/redis-server start method starts redis, then start redis in that directory, then the redis backup file is in that directory.

If you enter the command /etc/init.d/redis-server start in the /user/bin/redis/ directory, then the redis backup file is in /user/bin/redis/dump.rdb

If redis is installed through source code, you can restart redis through the shutdown command of the redis client program redis-cli

redis-cli -h 127.0.0.1 -p 6379 shutdown

If none of the above methods successfully stop redis, you can use the ultimate weapon kill -9

For more Redis related knowledge, please visit the Redis usage tutorial column!

The above is the detailed content of How to restart redis. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn