溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

redis中重啟的方法

發(fā)布時間:2020-08-24 16:25:17 來源:億速云 閱讀:240 作者:小新 欄目:關(guān)系型數(shù)據(jù)庫

這篇文章主要介紹了redis中重啟的方法,具有一定借鑒價值,需要的朋友可以參考下。希望大家閱讀完這篇文章后大有收獲。下面讓小編帶著大家一起了解一下。

redis如何重啟?

正常啟動命令:

redis-server  # 啟動redis服務(wù)端
[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

啟動redis客戶端

redis-cli 
127.0.0.1:6379>

如果是用apt-get或者yum install安裝的redis,可以直接通過下面的命令停止/啟動/重啟redis

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

注意:使用/etc/init.d/redis-server start 方法啟動redis,那么在那個目錄下啟動redis,那么redis的備份文件就在那個目錄下。

如在/user/bin/redis/目錄下輸入命令/etc/init.d/redis-server start  ,那么redis備份文件就在/user/bin/redis/dump.rdb

如果是通過源碼安裝的redis,則可以通過redis的客戶端程序redis-cli的shutdown命令來重啟redis

redis-cli -h 127.0.0.1 -p 6379 shutdown

如果上述方式都沒有成功停止redis,則可以使用終極武器 kill -9

感謝你能夠認真閱讀完這篇文章,希望小編分享redis中重啟的方法內(nèi)容對大家有幫助,同時也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,遇到問題就找億速云,詳細的解決方法等著你來學習!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI