Redis學習和應用記錄--介紹和安裝(1)

來源:互聯網
上載者:User

標籤:style   blog   http   color   io   os   使用   ar   strong   

   

Redis是一個開源的分布式緩衝架構,它也常被理解為資料結構伺服器,因為它包含豐富的資料類型,如LIST,SET,SORTEDSET,HASHES等。Redis的全稱是Remote Dictionary Server(遠端資料字典伺服器).

Redis的應用情境很多,可以替代Web Session,可以儲存大量的需要快速存取的資料(Cache),可以用來實現訊息佇列,可以作為分散式運算中的共用資料平台。這一節主要介紹Redis的安裝。分別介紹Linux和Windows 64位環境下Redis的安裝。

Linux環境下的安裝:

1. 下載Redis安裝包。到Redis的官方下載頁(http://redis.io/download)下載最新的安裝包。安裝包分為Stable版本和Beta版本,建議下載Stable版本。

2. 解壓安裝包,假設安裝包下載到/home/root/download下,執行如下命令:

1 [[email protected] ~]# cd /home/sam/Downloads/ 2 [[email protected] Downloads]# tar -zxvf redis-2.8.17.tar.gz

3. 進入redis專案檔夾,編譯redis並進行安裝。

1 [[email protected] Downloads]# cd redis-2.8.172 [[email protected] Downloads]# make

安裝需要有gcc編譯器,如果提示CC command cann‘t be found,請安裝gcc編譯器。

[[email protected] Downloads]# yum install gcc

4.安裝redis到/usbin目錄下.

[[email protected] Downloads]# make install

至此,redis安裝成功了,運行如下命令,啟動redis服務。

[[email protected] ~]# redis-server

Redis服務啟動後如:

5. 測試服務,使用redis-cli命令進行測試。

[[email protected] ~]# redis-cli set user 001OK[[email protected] ~]# redis-cli get user"001"[[email protected] ~]#

測試沒問題,Redis安裝成功。

Window 64bit環境下安裝Redis

Redis本身不支援Window系統,但是微軟開源技術委員會開發了一個項目,用於支援Redis。下載請點這裡 https://github.com/MSOpenTech/redis

下載下來的是原始碼,你可以使用Visual Studio進行編譯,我這裡提供一個編譯好的版本放在360雲端硬碟裡,請點擊這裡下載 http://yunpan.cn/cgwBqvCUA7uVp (提取碼:3e37)。

安裝步驟如下:

1. 下載zip檔案,解壓到指定目錄(如D:\redis-2.8.17).

2. 開啟dos視窗 開始->運行->輸入cmd斷行符號,進入redis安裝目錄。

C:\Users\Sam> D:D:> cd D:\redis-2.8.17

3.啟動Redis Server。

D:\redis-2.8.17> redis-server.exe

 啟動後

4. 測試Redis服務。

在dos命令列視窗中,進入Redis安裝目錄,使用redis-cli.exe進行測試。

C:\Users\Sam>d:D:\>cd redis-2.8.17D:\redis-2.8.17>redis-cli.exe set text helloOKD:\redis-2.8.17>redis-cli.exe get text"hello"D:\redis-2.8.17>

Windows下安裝Redis成功,如果需要將Redis註冊成Windows Service服務,則可以使用如下命令。

redis-server.exe --service-install redis.windows.conf --loglevel verbose

註冊成功後,可以在Window Service中看到如下服務。將Redis服務設為自動啟動,以後不用手動啟動Redis服務了。

下一節將介紹redis常用命令用法。

Redis學習和應用記錄--介紹和安裝(1)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.