2014年1月26日 星期日

[研究] Redis 2.8.4 資料庫 安裝(tar.gz)(CentOS 6.5 x64)

[研究] Redis 2.8.4 資料庫 安裝(tar.gz)(CentOS 6.5 x64)

2011-01-26
Lu

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.

官方網站
http://redis.io/

下載
http://code.google.com/p/redis/downloads/list
直接下載
http://download.redis.io/releases/redis-2.8.4.tar.gz

安裝參考
http://redis.io/download

安裝

yum -y install gcc gcc-c++
cd /usr/local
wget http://download.redis.io/releases/redis-2.8.4.tar.gz
tar zxvf redis-2.8.4.tar.gz
cd redis-2.8.4
make MALLOC=libc
make install

yum -y install tcl
make test


make test 在 34/35 執行會需要些時間

[33/35 done]: integration/replication-4 (75 seconds)
[34/35 done]: unit/obuf-limits (50 seconds)

另外,如果照官方只用 make 而不用 make MALLOC=lib,會有錯誤,要自己想辦法安裝 jemalloc

[root@localhost redis-2.8.4]# make
cd src && make all
make[1]: Entering directory `/root/redis-2.8.4/src'
    CC adlist.o
In file included from adlist.c:34:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/root/redis-2.8.4/src'
make: *** [all] Error 2
[root@localhost redis-2.8.4]#

jemalloc 官方網站
http://www.canonware.com/jemalloc/


啟動

[root@localhost ~]# /usr/local/bin/redis-server   /etc/retdis

測試

[root@localhost redis-2.8.4]# /usr/local/bin/redis-server --version
Redis server v=2.8.4 sha=00000000:0 malloc=libc bits=64 build=794349f94e0434d1
[root@localhost redis-2.8.4]#

[root@localhost ~]# ps aux | grep redis
root      5585  0.0  0.1 127700  2108 pts/2    Sl   13:53   0:00 /usr/local/bin/redis-server *:6379
root      5593  0.0  0.0 103244   864 pts/2    S+   13:53   0:00 grep redis

[root@localhost ~]# netstat -ntplu | grep redis
tcp        0      0 0.0.0.0:6379                0.0.0.0:*                   LISTEN      5585/redis-server *
tcp        0      0 :::6379                     :::*                        LISTEN      5585/redis-server *

[root@localhost ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]

[root@localhost ~]# redis-cli set foo bar
OK
[root@localhost ~]# redis-cli get foo
"bar"

[root@localhost ~]# yum -y install telnet 
[root@localhost ~]# telnet 127.0.0.1 6379
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
set foo 3
+OK
get foo
$1
3
^]
telnet> quit
Connection closed.
[root@localhost ~]#


更多命令介紹參考文檔介紹。
http://code.google.com/p/redis/wiki/CommandReference

(完)

[研究] Redis 2.8.4 資料庫 安裝(tar.gz)(CentOS 6.5 x64)
http://shaurong.blogspot.com/2014/01/redis-284-targzcentos-65-x64.html

[研究] Redis 2.4.10 資料庫 安裝(yum) (CentOS 6.5 x64)
http://shaurong.blogspot.tw/2014/01/redis-2410-yum-centos-65-x64.html

[研究] Redis 2.0.4 資料庫 安裝 (CentOS 5.5 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=19575

沒有留言:

張貼留言