redis 是一個基于記憶體的高性能key-value資料庫,資料都儲存在記憶體中定期重新整理到磁盤,以極高的讀寫效率而備受關注。他的特點是支援各種資料結構,stirng,hashes, list,set,和sorted sets
client端對于不同資料結構是使用不同的指令
這裡說一下redis的安裝
虛拟機環境: centos
1 wget make 安裝
tar xvzf redis-stable.tar.gz
cd redis-stable
make
注: 這裡記錄一下我安裝過程中出現的問題:
make: warning: file `makefile' has modification time 5.4e+06 s in the future
cd src && make all
make[1]: entering directory `/redis/redis-2.4.7/src'
make[1]: warning: file `makefile' has modification time 5.4e+06 s in the future
make hiredis
make[2]: entering directory `/redis/redis-2.4.7/deps/hiredis'
make[2]: warning: file `makefile' has modification time 5.4e+06 s in the future
cc -c -std=c99 -pedantic -o3 -fpic -wall -w -wstrict-prototypes -wwrite-strings -g -ggdb net.c
make[2]: cc: command not found
make[2]: *** [net.o] error 127
make[2]: leaving directory `/redis/redis-2.4.7/deps/hiredis'
make[1]: *** [dependencies] error 2
make[1]: leaving directory `/redis/redis-2.4.7/src'
make: *** [all] error 2
第一個問題
系統時間調整錯了,調過來就好了
第二個問題:
沒安裝gcc,
yum install gcc-c++
第三個問題:
make的時候顯示
which: no tclsh8.5 in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
you need 'tclsh8.5' in order to run the redis test
沒安裝tcl
安裝完成之後,make成功!
安裝成功之後會在src檔案夾内有redis-server和redis-cli兩個指令
建議将其放到bin下
sudo cp redis-server /usr/local/bin/
sudo cp redis-cli /usr/local/bin/
好了,現在redis就安裝成功了
2 測試redis安裝情況
我隻在一台虛拟機上安裝了redis,是以這台虛拟機既是伺服器,又是用戶端
測試:
1 使用securert打開一個會話,redis-server,讓其作為伺服器運作
[19282] 19 feb 23:52:57 - 1 clients connected (0 slaves), 726248 bytes in use
[19282] 19 feb 23:53:02 - db 0: 1 keys (0 volatile) in 4 slots ht.
[19282] 19 feb 23:53:02 - 1 clients connected (0 slaves), 726248 bytes in use
[19282] 19 feb 23:53:07 - db 0: 1 keys (0 volatile) in 4 slots ht.
[19282] 19 feb 23:53:07 - 1 clients connected (0 slaves), 726248 bytes in use
2 打開另一個會話:
ast login: tue feb 19 22:49:49 2013 from 192.168.1.103
set key和get key都正确
redis搭建測試通過
參考文章:
作者:yjf512(軒脈刃)
出處:http://www.cnblogs.com/yjf512/
本文版權歸yjf512和cnblog共有,歡迎轉載,但未經作者同意必須保留此段聲明