1、下載Redis安裝文件, Redis在Windows版本下載地址: https://github.com/MicrosoftArchive/redis/releases,我選擇的是 3.0.504 版本,有zip或msi可供下載。
2.解壓縮後,打開安裝目錄
雙擊redis-server.exe啟動redis服務器,雙擊redis-cli.exe打開redis客戶端。或者執行命令行redis-server redis.windows.conf。
redis的常用命令,使用命令進行安裝和註冊redis到window服務。
安裝命令:redis-server.exe --service-install redis.windows.conf --loglevel verbose
啟動服務命令:redis-server.exe --service-start
關閉服務命令:redis-server.exe --service-stop
註冊redis到window服務命令:redis-server --service-install redis.windows-service.conf --loglevel verbose
3、看到上圖就表示redis服務啟動成功。接下來將redis添加到windows服務,避免關閉命令行窗口服務停止。執行添加命令:redis-server --service-install redis.windows-service.conf --loglevel verbose。輸入命令沒有報錯,表示成功了,打開windows服務,會看到多了一個redis服務。
4、接下來測試一下。
打開一個cmd命令 ,調用命令是:redis-cli.exe -h 127.0.0.1 -p 6379,如下圖顯示地址和端口,說明調用成功。用set 和get 命令測試一下,可以獲取到對應set的值,說明調用成功。
英文學的好的同學也可以參考安裝目錄下的Windows Service Documentation.docx, 有什麼不對之處,還請大家指教。
閱讀更多 程序員球迷的日常 的文章