一、下載Redis安裝包
根據(jù)系統(tǒng)版本下載Redis安裝包
Linux版本下載地址:https://redis.io/download
Windows版本下載地址:https://github.com/microsoftarchive/redis/releases
本文以Windows為例,下載完成后解壓到自己的路徑
二、文件配置與安裝
1. 臨時服務(wù)安裝
進入Redis解壓后的目錄,并在該目錄下啟動命令行,輸入以下命令
redis-server.exe redis.windows.conf

image.png
打開Redis解壓后的目錄中的redis-cli.exe,運行redis客戶端,上一個窗口不能關(guān)閉

image.png
使用臨時服務(wù)安裝,不會出現(xiàn)在Windows服務(wù)中
- 默認(rèn)服務(wù)安裝
進入Redis解壓后的目錄,并在該目錄下啟動命令行,輸入以下命令
redis-server.exe --service-install redis.windows.conf --loglevel verbose
注:一定要把臨時服務(wù)關(guān)閉,否則安裝不上
啟動/暫停/卸載服務(wù)
# 啟動
redis-server.exe --service-start
# 暫停
redis-server.exe --service-stop
# 卸載
redis-server.exe --service-uninstall
使用默認(rèn)服務(wù)安裝,會出現(xiàn)在Windows服務(wù)中
- 自定義服務(wù)安裝
進入Redis解壓后的目錄,并在該目錄下啟動命令行,輸入以下命令
redis-server.exe --service-install redis.windows.conf --Service-name RedisServer1 --loglevel verbose
啟動/暫停/卸載服務(wù)
# 啟動
redis-server.exe --service-start --Service-name RedisServer1
# 暫停
redis-server.exe --service-stop --Service-name RedisServer1
# 卸載
redis-server.exe --service-uninstall --Service-name RedisServer1
使用自定義服務(wù)安裝,可以重命名服務(wù)名并會出現(xiàn)在Windows服務(wù)中