1. 程式人生 > >Windows下安裝並設定Redis

Windows下安裝並設定Redis

作者: 鐵錨

日期: 2014年8月10日

Redis對於Linux是官方支援的,安裝和使用沒有什麼好說的,普通使用按照官方指導,5分鐘以內就能搞定。詳情請參考:

但有時候又想在windows下折騰下Redis,可以從redis下載頁面看到如下提示(在頁面中搜索 "windows"):

Win64	Unofficial	The Redis project does not directly support Windows, 
	however the Microsoft Open Tech group develops and maintains 
	an Windows port targeting Win64.

大意就是 Redis官方是不支援windows的,只是 Microsoft Open Tech group 在 GitHub上開發了一個Win64的版本,專案地址是:

開啟以後,可以直接使用瀏覽器下載,或者git克隆。


在 Release 頁面中,可以找到 msi 安裝檔案以及 .zip 檔案(而且有3.0的beta版,請下拉查詢)。

下載解壓,沒什麼好說的,在解壓後的bin目錄下有以下這些檔案:

redis-benchmark.exe         #基準測試
redis-check-aof.exe         # aof
redis-check-dump.exe        # dump
redis-cli.exe               # 客戶端
redis-server.exe            # 伺服器
redis.windows.conf          # 配置檔案
當然,還有一個 RedisService.docx 檔案,看似是一些啟動和安裝服務的說明文件,但是照著他的指示來,你就會死的很慘,莫名其妙的死了,不知道原因。

【換機器重新測試後已查明,如果不是Administrator使用者,就會出各種問題,服務安裝以後啟動不了等等問題,應該可以修改服務的屬性-->登入使用者等選項來修正.】

【如果你安裝的windows沒有Administrator賬戶,請參考這篇文章:

 】

網上參考了一些資料,發覺可以使用,也就沒有深究,直接拿來主義:

啟動指令碼如下:

redis-server  redis.windows.conf
可以將其儲存為檔案 startup.bat
 ; 下次就可以直接啟動了。

但是在cmd之中執行這行命令之後報錯:

D:\Develop\redis-2.8.12>redis-server.exe redis.windows.conf
[7736] 10 Aug 21:39:42.974 #
The Windows version of Redis allocates a large memory mapped file for sharing
the heap with the forked process used in persistence operations. This file
will be created in the current working directory or the directory specified by
the 'dir' directive in the .conf file. Windows is reporting that there is
insufficient disk space available for this file (Windows error 0x70).

You may fix this problem by either reducing the size of the Redis heap with
the --maxheap flag, or by starting redis from a working directory with
sufficient space available for the Redis heap.

Please see the documentation included with the binary distributions for more
details on the --maxheap flag.

Redis can not continue. Exiting.

根據提示,是 maxheap 標識有問題,開啟配置檔案 redis.windows.conf ,搜尋 maxheap , 然後直接指定好內容即可.
.......
#  
# maxheap <bytes>
maxheap 1024000000
.......
然後再次啟動,OK,成功.
D:\Develop\redis-2.8.12>redis-server  redis.windows.conf
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 2.8.12 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in stand alone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 6736
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[6736] 10 Aug 22:01:22.247 # Server started, Redis version 2.8.12
[6736] 10 Aug 22:01:22.248 * The server is now ready to accept connections on port 6379

然後可以使用自帶的客戶端工具進行測試。

雙擊開啟 redis-cli.exe , 如果不報錯,則連線上了本地伺服器,然後測試,比如 set命令,get命令:

127.0.0.1:6379> set tiemao http://blog.csdn.net/renfufei
OK
127.0.0.1:6379> get tiemao
"http://blog.csdn.net/renfufei"
127.0.0.1:6379>
這應該很好理解,連線上了本機的6379埠。

如果需要幫助,可以在 cli視窗中輸入 help檢視,例如:

127.0.0.1:6379> help
redis-cli 2.8.12
Type: "help @<group>" to get a list of commands in <group>
      "help <command>" for help on <command>
      "help <tab>" to get a list of possible help topics
      "quit" to exit
127.0.0.1:6379> help @string
根據提示,可以輸入 help 空格 然後敲tab鍵,可以像命令提示一樣告訴你可以有哪些幫助分組,多敲幾個 tab 試試?
備註說明:

1. 這個版本是Win64的,所以32位windows就不要折騰了。

2. 我的作業系統是Windows 7 64位旗艦版,執行記憶體16GB,使用者不是Administrator,而是 hasee,所以設定了下 redis-server.exe 和redis-cli.exe 的屬性中的相容性許可權(以管理員身份執行),如果你執行出錯,可能需要設定一下這裡。

3. 什麼360啊,UAC啊,防火牆啊,該關的請關閉。。。

4. 如果有其他問題,歡迎留言或者評論, 這只是一個心血來潮時的折騰
接觸了好久Redis但一直沒在windows下使用,請輕拍。

附加幾個 bat 批處理指令碼,請根據需要靈活配置

service-install.bat

redis-server.exe --service-install redis.windows.conf --loglevel verbose
uninstall-service.bat
redis-server --service-uninstall
startup.bat
redis-server.exe redis.windows.conf


相關推薦

Windows安裝設定Redis

作者: 鐵錨日期: 2014年8月10日Redis對於Linux是官方支援的,安裝和使用沒有什麼好說的,普通使用按照官方指導,5分鐘以內就能搞定。詳情請參考:但有時候又想在windows下折騰下Redis,可以從redis下載頁面看到如下提示(在頁面中搜索 "windows"

Windows安裝啟動mongodb

mon custom out install 自定義 path 管理器 unit window 一、Windows下mongodb的安裝 MongoDB 提供了可用於 32 位和 64 位系統的預編譯二進制包,你可以從MongoDB官網下載安裝,MongoDB 預編譯二進制

windows安裝啟動hadoop2.7.2

64位windows安裝hadoop沒必要倒騰Cygwin,直接解壓官網下載hadoop安裝包到本地->最小化配置4個基本檔案->執行1條啟動命令->完事。一個前提是你的電腦上已經安裝了jdk,設定了java環境變數。下面把這幾步細化貼出來,以

windows安裝和啟動redis伺服器

1、下載redis: https://github.com/dmajkic/redis/downloads (裡面有windows 32位) 2、從cmd進入redis本地目錄後開啟服務: redis-server.exe redis.conf會出現如下: 這個視窗要

windows安裝啟動hadoop2.6.1

64位windows安裝hadoop沒必要倒騰Cygwin,直接解壓官網下載hadoop安裝包到本地->最小化配置4個基本檔案->執行1條啟動命令->完事。一個前提是你的電腦上已經安裝了jdk,設定了java環境變數,本人用的是jdk1.7.0

windows安裝使用Python的SSH模組(paramiko+pycrypto+ecdsa)

Python中使用SSH需要用到OpenSSH,而OpenSSH依賴於paramiko模組,而paramiko模組又依賴於pycrypto模組,因此要在Python中使用SSH,則需要先安裝模組順序是:pycrypto -> ecdsa -> paramiko

Windows安裝Redis設定開機自動啟動

一、首先是下載Redis(這裡我選擇64位) 二、解壓壓縮包,進入安裝目錄 在空白處按下shift+滑鼠右鍵,開啟命令視窗。 三、輸入命令執行:redis-server –service-install redis.windows.conf

windows 安裝composer下載第三方類庫(設定環境變數path)

第一步 第二步 第三步 第四步 將變數值複製到編輯器裡 如下: C:\Program Files\Python36\Scripts\;C:\Program Files\Python36\;%SystemRoot%\system32;%SystemRo

windows安裝redis以及redis擴充套件,設定rediswindows自啟服務

我自己經過測試後,發現有些網上的教程挺坑。 其實只要安裝完redis後,擴充套件需要注意一下,extension=php_igbinary.dll 可以不要擴充套件,要不然會出問題。暫時不知道為什麼會這樣。估計是PHP有的版本已經有這個了。 windows下安裝reids 啟動redis服務:在red

REDIS教程{1}windows 安裝redis測試(-)

1、redis簡介 redis是一個key-value儲存系統。和Memcached類似,它支援儲存的value型別相對更多,包括string(字串)、list(連結串列)、set(集合)、zset(sorted set --有序集合)和hashs(雜湊型別)。這些資料型別都支援push/pop、add/r

Windows安裝tomcat7設定開機啟動服務

一、下載tomcat7並選擇32/64位 二、解壓tomcat,cd到tomcat的bin目錄下 2.1執行service.bat install命令安裝服務 2.2再執行net

redis windows安裝

3.0 ack cnblogs 文件 下載地址 download log nload window 1.下載redis windows文件包 下載地址 2.解壓文件包 復制壓縮包地址 3.進入cmd 命令行 cd進入redis文件包目錄 4.執行 redis-server.

Rediswindows安裝過程

pos med title 1-1 width nbsp serve 下載地址 pad 一、下載windows版本的Redis 去官網找了很久,發現原來在官網上可以下載的windows版本的,現在官網以及沒有下載地址,只能在github上下載,官網只提供linux版本的下

windows安裝redis

div python 一個 src 集合 部分 排序。 pos 緩存 1、redis簡介redis是一個key-value存儲系統。和Memcached類似,它支持存儲的value類型相對更多,包括string(字符串)、list(鏈表)、set(集合)、zset(sor

windows安裝Redis步驟(收集)

idt rbo 官網 git font bsp spa med play 一、下載windows版本的Redis 去官網找了很久,發現原來在官網上可以下載的windows版本的,現在官網以及沒有下載地址,只能在github上下載,官網只提供linux版本的下載 官網下載地址

windows安裝redis 以及phpredis的擴展 (windows redis php&php7)

com sts 刪除 connect 移動 技術分享 base getopt 操作 一、工具準備 1. redis for windows 下載 https://github.com/MSOpenTech/redis 2. PHP擴展下載 http://pecl.php

windows 安裝redis

oss 啟動 set 出現 redis-cli .com shadow 否則 type windows 下安裝redis 首先解壓 redis_win.zip 壓縮包 裏面有redisbin_x32.zip和redisbin_x64.zip 2個壓縮包 如下圖所示: 如果是

如何在Windows安裝MYSQL,截圖說明

family CP 選擇 查找 報錯 mage 端口號 ron 訪問 說明 : window 下安裝 mysql 雖然簡單,但是細節不註意就會安裝失敗,特別是配置服務器時,Current Root Password:為空;如果輸入密碼了在後面安裝會報錯。(不知道設置這個密碼

Windows 安裝 Redis

Win redis 服務 首次啟動報錯 redis-server.exe redis.windows.conf //啟動redis服務 creating server tcp listening socket 127.0.0.1:6379: bind No error //

windows安裝redis集群

window .net https tps 本機 win10 win 集群 blank 前幾天在自己在本機win10 電腦下部署了redis集群。 主要通過的是網上兩個博客: 如何在windows下部署redis集群:https://blog.csdn.net/zsg88/