redis搭建實戰記錄

fmms 12年前發布 | 41K 次閱讀 Redis NoSQL數據庫

Redis is an open source, advanced  key-value store . It is often referred to as a  data structure server  since keys can contain strings hashes lists sets  and  sorted sets .   

-- from http://redis.io/ 

 

redis  是一個基于內存的高性能key-value數據庫,數據都保存在內存中定期刷新到磁盤,以極高的讀寫效率而備受關注。他的特點是支持各種數據結構,stirng,hashes, list,set,和sorted sets

client端對于不同數據結構是使用不同的命令

 

這里說一下redis的安裝

虛擬機環境: centos 

 

1 wget  make 安裝

wget http://download.redis.io/redis-stable.tar.gz

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

 

 

第一個問題

make: Warning: File `Makefile' has modification time 5.4e+06 s in the future

系統時間調整錯了,調過來就好了

 

第二個問題:

make[2]: Entering directory `/redis/redis-2.4.7/deps/hiredis'

cc -c -std=c99 -pedantic -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings    -g -ggdb  net.c

make[2]: cc: Command not found

沒安裝gcc

yum install gcc-c++

 

第三個問題:

make的時候顯示

make[1]: Entering directory `/redis/redis-2.4.7/src'

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

按照官網http://www.linuxfromscratch.org/blfs/view/cvs/general/tcl.html 上的安裝
 

安裝完成之后,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

redis搭建實戰記錄

 

set keyget key都正確

redis搭建測試通過 

 

參考文章:

http://redis.io/ 

http://redis.io/topics/quickstart 

http://hi.baidu.com/thinkinginlamp/blog/item/3358c93d174e35ce9f3d62bf.html 

 

作者:yjf512(軒脈刃)

出處:http://www.cnblogs.com/yjf512/

 本文由用戶 fmms 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!