CentOS 5.10 下安裝配置redis

來源:互聯網
上載者:User

CentOS 5.10 下安裝配置redis

本來想整點遊戲,但是工作一直在做hybrid。

忙是一個借口,昨天白天是睡過去的,在連續奮戰22個小時上線生產後,雖然又發現了新問題——越獄版蘋果4s下拉重新整理又有bug。但是也僅僅是發現了一台會出現這個問題,希望天亮能翻開這一頁,畢竟新需求眼瞅又得開始編碼了,預計12底上線的活動,這幾天我一直都在關注大家的白頭髮。

個人部落格整了許久,express3加mongodb打造的,雖然上線了,但是很多功能沒有完善,最近想統計訪問量決定用redis打造。

putty進入我的雲端服務器

到http://download.redis.io/releases/可以找到各種版本的redis

[plain]view plaincopyprint?
  1. #wgethttp://download.redis.io/releases/redis-2.6.14.tar.gz

解壓

[plain]view plaincopyprint?
  1. tarzxvfredis-2.6.14.tar.gz

進入解壓目錄 安裝

[plain]view plaincopyprint?
  1. cdredis-2.6.14

[plain]view plaincopyprint?
  1. make
[plain]view plaincopyprint?
  1. zmalloc.o:Infunction`zmalloc_used_memory':
  2. /usr/local/src/redis-2.6.14/src/zmalloc.c:223:undefinedreferenceto`__sync_add_and_fetch_4'
  3. collect2:ldreturned1exitstatus
  4. make[1]:***[redis-server]Error1
  5. make[1]:Leavingdirectory`/usr/local/src/redis-2.6.14/src'
  6. make:***[all]Error2

報錯了:

網上查了一下,因為的我的系統是32位的,所以得在make後加FLAGS="-march=i686"

[plain]view plaincopyprint?
  1. makeCFLAGS="-march=i686"

安裝沒有再上面的問題

[plain]view plaincopyprint?
  1. makeinstall<spanstyle="font-family:Monaco,'DejaVuSansMono','BitstreamVeraSansMono',Consolas,'CourierNew',monospace;line-height:18px;background-color:rgb(250,250,250);">安裝會把redis的命令被拷貝到/usr/local/bin下面</span>

提示

[plain]view plaincopyprint?
  1. cdsrc&&makeinstall

執行這步後提示To run 'make test' is a good idea ;) 對於這一步的test ————測試案例,非必選,可以跳過。

[plain]view plaincopyprint?
  1. maketest

居然提示You need tcl 8.5 or newer in order to run the Redis test

網上找tcl8.5安裝

[plain]view plaincopyprint?
  1. wgethttp://downloads.sourceforge.net/tcl/tcl8.5.10-src.tar.gz
  2. tarxzvftcl8.5.10-src.tar.gz
  3. <prename="code"class="plain">cdtcl8.5.10/unix/
[plain]view plaincopyprint?
  1. ./configure
  2. make
  3. makeinstall

安裝成功後,回到 目錄,繼續執行 make test,卡在

[plain]view plaincopyprint?
  1. [30/32done]:unit/sort(72seconds)
  2. [ok]:Clientoutputbuffersoftlimitisenforcediftimeisoverreached
  3. [31/32done]:unit/obuf-limits(40seconds)

ctrl+c強制停止,再試了幾次,卡得不耐煩後,終於出現

[plain]view plaincopyprint?
  1. \o/Alltestspassedwithouterrors!
  2. Cleanup:maytakesometime...OK

redis用例測試成功

在啟動redis前,回到上一級目錄,編輯redis.conf,修改配置

vim redis.conf

把daemonizeno改成daemonizeyes,這樣啟動redis時就會成會後台服務

把#bind 127.0.0.1改成bind 127.0.0.1

這樣遠程就不能訪問,安全性考慮,當然還可以配置連接埠,密碼等。

然後進入/usr/local/src/redis-2.6.14/src目錄 啟動

[plain]view plaincopyprint?
  1. [root@iZ28jgc6wlbZsrc]#./redis-server./../redis.conf
  2. [root@iZ28jgc6wlbZsrc]#grepredis
  3. [root@iZ28jgc6wlbZsrc]#redis-cli
  4. redis127.0.0.1:6379>sethelloworld
  5. OK
  6. redis127.0.0.1:6379>gethello
  7. "world"
  8. redis127.0.0.1:6379>

redis安裝 並且操作成功。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.