主頁 > 知識(shí)庫 > 64位Windows下安裝Redis教程

64位Windows下安裝Redis教程

熱門標(biāo)簽:AI電銷 Linux服務(wù)器 百度競(jìng)價(jià)排名 服務(wù)外包 網(wǎng)站排名優(yōu)化 鐵路電話系統(tǒng) 呼叫中心市場(chǎng)需求 地方門戶網(wǎng)站

Redis對(duì)于Linux是官方支持的,安裝和使用沒有什么好說的,普通使用按照官方指導(dǎo),5分鐘以內(nèi)就能搞定。詳情請(qǐng)參考:http://redis.io/download

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

復(fù)制代碼 代碼如下:

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上開發(fā)了一個(gè)Win64的版本,項(xiàng)目地址是:https://github.com/MSOpenTech/redis

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

可以在項(xiàng)目主頁右邊找到 zip包下載地址: https://github.com/MSOpenTech/redis/archive/2.8.zip

下載解壓,沒什么好說的,在解壓后的bin目錄下有以下這些文件:

復(fù)制代碼 代碼如下:

redis-benchmark.exe         #基準(zhǔn)測(cè)試
redis-check-aof.exe         # aof
redis-check-dump.exe        # dump
redis-cli.exe               # 客戶端
redis-server.exe            # 服務(wù)器
redis.windows.conf          # 配置文件

當(dāng)然,還有一個(gè) RedisService.docx 文件,看似是一些啟動(dòng)和安裝服務(wù)的說明文檔,但是照著他的指示來,你就會(huì)死的很慘,莫名其妙的死了,不知道原因。
【換機(jī)器重新測(cè)試后已查明,如果不是Administrator用戶,就會(huì)出各種問題,服務(wù)安裝以后啟動(dòng)不了等等問題,應(yīng)該可以修改服務(wù)的屬性-->登錄用戶等選項(xiàng)來修正.】

【如果你安裝的windows沒有Administrator賬戶,請(qǐng)參考這篇文章:Windows 7 啟用超級(jí)管理員administrator賬戶的N種方法】

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

啟動(dòng)腳本如下:

復(fù)制代碼 代碼如下:

redis-server  redis.windows.conf

可以將其保存為文件 startup.bat ; 下次就可以直接啟動(dòng)了。
但是在cmd之中執(zhí)行這行命令之后報(bào)錯(cuò):

復(fù)制代碼 代碼如下:

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.

根據(jù)提示,是 maxheap 標(biāo)識(shí)有問題,打開配置文件 redis.windows.conf ,搜索 maxheap , 然后直接指定好內(nèi)容即可.

復(fù)制代碼 代碼如下:

.......

# maxheap bytes>
maxheap 1024000000
.......

然后再次啟動(dòng),OK,成功.

復(fù)制代碼 代碼如下:

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

然后可以使用自帶的客戶端工具進(jìn)行測(cè)試。
雙擊打開 redis-cli.exe , 如果不報(bào)錯(cuò),則連接上了本地服務(wù)器,然后測(cè)試,比如 set命令,get命令:

復(fù)制代碼 代碼如下:

127.0.0.1:6379> set tiemao https://www.jb51.net
OK
127.0.0.1:6379> get tiemao
"https://www.jb51.net"
127.0.0.1:6379>

這應(yīng)該很好理解,連接上了本機(jī)的6379端口。

如果需要幫助,可以在 cli窗口中輸入 help查看,例如:

復(fù)制代碼 代碼如下:

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

根據(jù)提示,可以輸入 help 空格 然后敲tab鍵,可以像命令提示一樣告訴你可以有哪些幫助分組,多敲幾個(gè) tab 試試?
備注說明:

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

2. 我的操作系統(tǒng)是Windows 7 64位旗艦版,運(yùn)行內(nèi)存16GB,用戶不是Administrator,而是 hasee,所以設(shè)置了下 redis-server.exe 和redis-cli.exe 的屬性中的兼容性權(quán)限(以管理員身份運(yùn)行),如果你運(yùn)行出錯(cuò),可能需要設(shè)置一下這里。

3. 什么360啊,UAC啊,防火墻啊,該關(guān)的請(qǐng)關(guān)閉。。。

4. 如果有其他問題,歡迎留言或者評(píng)論, 這只是一個(gè)心血來潮時(shí)的折騰

接觸了好久Redis但一直沒在windows下使用,請(qǐng)輕拍。

您可能感興趣的文章:
  • Windows下安裝Redis及使用Python操作Redis的方法
  • Windows下Redis的安裝使用教程
  • Windows下Redis的安裝使用圖解
  • NoSQL和Redis簡(jiǎn)介及Redis在Windows下的安裝和使用教程
  • redis在Windows中下載及安裝、設(shè)置教程
  • Windows下redis下載、redis安裝及使用教程

標(biāo)簽:崇左 銅川 湖南 蘭州 黃山 湘潭 衡水 仙桃

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《64位Windows下安裝Redis教程》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266