标签:redis
Redis是RemoteDictionary Server的缩写。是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型的数据库,他本质上一个Key/Value数据库,与Memcached类似的NoSQL型数据库,但是他的数据可以持久化的保存在磁盘上,解决了服务重启后数据不丢失的问题,他的值可以是string(字符串)、list(列表)、sets(集合)或者是ordered sets(被排序的集合),所有的数据类型都具有push/pop、add/remove、执行服务端的并集、交集、两个sets集中的差别等等操作,这些操作都是具有原子性的,Redis还支持各种不同的排序能力。
从2010年3月15日起,Redis的开发工作由VMware主持。从2013年5月开始,Redis的开发由Pivotal赞助。
Redis是一个高性能的key-value数据库。 redis的出现,很大程度补偿了memcached这类key/value存储的不足,在部分场合可以对关系数据库起到很好的补充作用。它提供了Java,C/C++,C#,PHP,JavaScript,Perl,Object-C,Python,Ruby,Erlang等客户端,使用很方便。
Tcl软件包为redis安装过程执行maketest调用到的包,tcl未安装或版本低于8.5会报以下错误:
Youneed tcl 8.5 or newer in order to run the Redis test
[root@huntdb soft]# wget http://downloads.sourceforge.net/tcl/tcl8.6.4-src.tar.gz [root@huntdb soft]# tar -xzvf tcl8.6.4-src.tar.gz [root@huntdb soft]# cd tcl8.6.4 [root@huntdb tcl8.6.4]# cd unix/ [root@huntdb unix]# ./configure [root@huntdb unix]# make && make install
编译过程若出现以下错误,则需要修改系统当前日期:
make:warning: Clock skew detected. Your build may be incomplete
[root@huntdb unix]# date -s "2015-3-16 9:45:34" [root@huntdb unix]# make clean [root@huntdb unix]# make && make install
1.创建安装目录
创建用于存放redis的日志、配置文件、rdb/aof文件所需目录
[root@huntdb /]# mkdir /usr/local/redis [root@huntdb /]# mkdir /usr/local/redis/etc/ [root@huntdb /]# mkdir /usr/local/redis/log/ [root@huntdb /]# mkdir /usr/local/redis/data/
2.安装redis
最新版本新到http://redis.io/download下载
[root@huntdb soft]# wget http://download.redis.io/releases/redis-2.8.19.tar.gz [root@huntdb soft]# tar -xzvf redis-2.8.19.tar.gz [root@huntdb soft]# cd redis-2.8.19 [root@huntdbredis-2.8.19]# make [root@huntdbredis-2.8.19]# make test cd src && make test make[1]: Entering directory`/opt/soft/redis-2.8.19/src‘ Cleanup: may take some time... OK Starting test server at port 11111 [ready]: 14710 Testing unit/printver [ready]: 14717 Testing unit/auth [ready]: 14724 Testing unit/protocol [ready]: 14731 Testing unit/basic [ready]: 14738 Testing unit/scan ... [ok]: Check encoding - ziplist [ok]: ZSET basic ZADD and score update- ziplist [ok]: ZSET element can‘t be set to NaNwith ZADD - ziplist [ok]: ZSET element can‘t be set to NaNwith ZINCRBY [ok]: ZINCRBY calls leading to NaNresult in error [ok]: ZADD - Variadic version basecase [ok]: ZADD - Return value is the numberof actually added items [ok]: ZADD - Variadic version does notadd nothing on single parsing err [ok]: ZADD - Variadic version willraise error on missing arg [ok]: ZINCRBY does not work variadiceven if shares ZADD implementation [ok]: ZCARD basics - ziplist [ok]: ZREM removes key after lastelement is removed [ok]: ZREM variadic version ... \o/ All tests passed without errors! [root@huntdbredis-2.8.19]# make PREFIX=/usr/local/redis install [root@huntdbredis-2.8.19]# cp redis.conf/usr/local/redis/etc/ [root@huntdbredis-2.8.19]# cd /usr/local/redis/ [root@huntdb redis]# cd bin/ [root@huntdb bin]# ll total 12460 -rwxr-xr-x 1 root root 3738868 Mar 1610:33 redis-benchmark -rwxr-xr-x 1 root root 17124 Mar 16 10:33 redis-check-aof -rwxr-xr-x 1 root root 36963 Mar 16 10:33 redis-check-dump -rwxr-xr-x 1 root root 3814098 Mar 1610:33 redis-cli lrwxrwxrwx 1 root root 33 Mar 16 10:33 redis-sentinel ->/usr/local/redis/bin/redis-server -rwxr-xr-x 1 root root 5116249 Mar 1610:33 redis-server
bin目录可执行文件的作用如下:
redis-server:Redis服务器的daemon启动程序
redis-cli:Redis命令行操作工具。也可以用telnet根据其纯文本协议来操作
redis-benchmark:Redis性能测试工具,测试Redis在当前系统下的读写性能
redis-check-aof:数据修复
redis-check-dump:检查导出工具
启动
/usr/local/redis/bin/redis-server/usr/local/redis/etc/redis.conf
停止
/usr/local/redis/bin/redis-cli -p [6379|自定义端口] shutdown
本文出自 “HUNT” 博客,请务必保留此出处http://hunt1574.blog.51cto.com/1390776/1631772
标签:redis
原文地址:http://hunt1574.blog.51cto.com/1390776/1631772