redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set –有序集合)和hash(哈希类型)。以上数据类型支持push/pop、add/remove及取交集并集和差集及更丰富的操作,并且这些操作都是基于原子性。还有,redis支持各种不同方式的排序。与memcached一样,为了保证效率,数据都是缓存在内存中。区别的是redis会周期性的把更新的数据写入磁盘或者把修改操作写入追加的记录文件,并且在此基础上实现了master-slave(主从)同步。
1、安装环境
centos-64
2、Wget make 安装
—wget http://download.redis.io/releases/redis-2.8.9.tar.gz
—tar xvzf redis-2.8.9.tar.gz
—cd redis-2.8.9
—make 或者make install (可把运行文件复制到/user/local/bin)
以下记录安装过程出现的问题
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.8.9/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.8.9/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.8.9/deps/hiredis'
make[1]: *** [dependencies] Error 2
make[1]: Leaving directory `/redis/redis-2.8.9/src'
make: *** [all] Error 2
make[1]: Entering directory `/home/centos/Desktop/redis/redis-2.8.9/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 `/home/centos/Desktop/redis/redis-2.8.9/src'
make: *** [install] Error 2
第一个问题
make: Warning: File `Makefile’ has modification time 5.4e+06 s in the future
系统时间调整错了,调过来就好了
第二个问题
make[2]: Entering directory `/redis/redis-2.8.9/deps/hiredis’
cc -c -std=c99 -pedantic -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
make[2]: cc: Command not foundgcc,
解决方法:yum install gcc-c++
第三个问题
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 MALLOC=libc
第四个问题:
make的时候显示
make[1]: Entering directory `/redis/rredis-2.8.9/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 上的安装
#tar xvzf tcl8.5.12-src.tar.gz
#cd tcl8.5.13/unix/
#./configure
#make
#make test (可跳过)
#make install
或者采用 yum install tcl
安装之后,make成功
3、测试是否成功
make test
\o/ All tests passed without errors!
Cleanup: may take some time… OK
表示redis安装成功了。
4、开启服务(设置端口和日志路径等)
5、运行redis
在centos打开两个终端
—先运行redis-server
—后运行客户端测试
6. 关闭服务
redis-cli shutdown
如果端口变化可以指定端口:
redis-cli -p 6379 shutdown
参考网址:http://www.cnblogs.com/yjf512/archive/2012/02/20/2358799.html