redis这么火,我也试着自己看看学习学习吧。
1. redis简介:
REmote DIctionary Server(Redis) 是一个由Salvatore Sanfilippo写的key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)和zset(有序集合)。这些数据类型都支持push/pop、add/remove及取交集并集和差集及更丰富的操作,而且这些操作都是原子性的。在此基础上,redis支持各种不同方式的排序。与memcached一样,为了保证效率,数据都是缓存在内存中。区别的是redis会周期性的把更新的数据写入磁盘或者把修改操作写入追加的记录文件,并且在此基础上实现了master-slave(主从)同步。
性能
下面是官方的bench-mark数据:
The test was done with 50 simultaneous clientsperforming 100000 requests.
The value SET and GET is a 256 bytes string.
The Linux box is running Linux 2.6, it’s XeonX3320 2.5Ghz.
Text executed using the loopback interface(127.0.0.1).
Results: about 110000 SETs per second, about81000 GETs per second
•Redis是一款开源的、高性能的键-值存储(key-valuestore)。它常被称作是一款数据结构服务器(data structure server)。Redis的键值可以包括字符串(strings)类型,同时它还包括哈希(hashes)、列表(lists)、集合(sets)和 有序集合(sorted sets)等数据类型。 对于这些数据类型,你可以执行原子操作。例如:对字符串进行附加操作(append);递增哈希中的值;向列表中增加元素;计算集合的交集、并集与差集等。
•为了获得优异的性能,Redis采用了内存中(in-memory)数据集(dataset)的方式。同时,Redis支持数据的持久化,你可以每隔一段时间将数据集转存到磁盘上(snapshot),或者在日志尾部追加每一条操作命令(append only file,aof)。
•Redis同样支持主从复制(master-slave replication),并且具有非常快速的非阻塞首次同步( non-blocking first synchronization)、网络断开自动重连等功能。同时Redis还具有其它一些特性,其中包括简单的事物支持、发布订阅 ( pub/sub)、管道(pipeline)和虚拟内存(vm)等 。
•Redis具有丰富的客户端,支持现阶段流行的大多数编程语言。( http://redis.io/clients)
2.安装
从官方网站上:http://code.google.com/p/redis/downloads/list?can=1下载相应的版本。
稳定的版本号为偶数,奇数为测试版本。
当前下载的版本为:redis-2.6.10.tar.gz
解压:redis-2.6.10
gzip –d redis-2.6.10.tar.gz
tar –xvf redis-2.6.10.tar
3. build
build 环境: Linux 6.3
[/u1/yyang/study/redis/redis-2.6.10](110)yyang@dcmvrh12#uname -a
Linux dcmvrh12 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
执行make 命令build redis
[/u1/yyang/study/redis/redis-2.6.10](107)yyang@dcmvrh12#make
cd src && make all
make[1]: Entering directory `/users/denver/yyang/study/redis/redis-2.6.10/src'
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-dump redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html
(cd ../deps && make distclean)
make[2]: Entering directory `/users/denver/yyang/study/redis/redis-2.6.10/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: Leaving directory `/users/denver/yyang/study/redis/redis-2.6.10/deps'
(rm -f .make-*)
echo STD=-std=c99 -pedantic >> .make-settings
echo WARN=-Wall >> .make-settings
echo OPT=-O2 >> .make-settings
echo MALLOC=jemalloc >> .make-settings
echo CFLAGS= >> .make-settings
echo LDFLAGS= >> .make-settings
echo REDIS_CFLAGS= >> .make-settings
echo REDIS_LDFLAGS= >> .make-settings
echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -Wall -O2 -g -rdynamic -ggdb -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
echo PREV_FINAL_LDFLAGS= -g -rdynamic -ggdb >> .make-settings
(cd ../deps && make hiredis linenoise lua jemalloc)
make[2]: Entering directory `/users/denver/yyang/study/redis/redis-2.6.10/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
(echo "" > .make-ldflags)
(echo "" > .make-cflags)
MAKE hiredis
cd hiredis && make static
make[3]: Entering directory `/users/denver/yyang/study/redis/redis-2.6.10/deps/hiredis'
cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb hiredis.c
cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb sds.c
cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb async.c
ar rcs libhiredis.a net.o hiredis.o sds.o async.o
make[3]: Leaving directory `/users/denver/yyang/study/redis/redis-2.6.10/deps/hiredis'
MAKE linenoise
cd linenoise && make
make[3]: Entering directory `/users/denver/yyang/study/redis/redis-2.6.10/deps/linenoise'
cc -Wall -Os -g -c linenoise.c
make[3]: Leaving directory `/users/denver/yyang/study/redis/redis-2.6.10/deps/linenoise'
MAKE lua
cd lua/src && make all CFLAGS="-O2 -Wall -DLUA_ANSI " MYLDFLAGS=""
make[3]: Entering directory `/users/denver/yyang/study/redis/redis-2.6.10/deps/lua/src'
gcc -O2 -Wall -DLUA_ANSI -c -o lapi.o lapi.c
gcc -O2 -Wall -DLUA_ANSI -c -o lcode.o lcode.c
gcc -O2 -Wall -DLUA_ANSI -c -o ldebug.o ldebug.c
gcc -O2 -Wall -DLUA_ANSI -c -o ldo.o ldo.c
gcc -O2 -Wall -DLUA_ANSI -c -o ldump.o ldump.c
gcc -O2 -Wall -DLUA_ANSI -c -o lfunc.o lfunc.c
gcc -O2 -Wall -DLUA_ANSI -c -o lgc.o lgc.c
gcc -O2 -Wall -DLUA_ANSI -c -o llex.o llex.c
gcc -O2 -Wall -DLUA_ANSI -c -o lmem.o lmem.c
gcc -O2 -Wall -DLUA_ANSI -c -o lobject.o lobject.c
gcc -O2 -Wall -DLUA_ANSI -c -o lopcodes.o lopcodes.c
gcc -O2 -Wall -DLUA_ANSI -c -o lparser.o lparser.c
gcc -O2 -Wall -DLUA_ANSI -c -o lstate.o lstate.c
gcc -O2 -Wall -DLUA_ANSI -c -o lstring.o lstring.c
gcc -O2 -Wall -DLUA_ANSI -c -o ltable.o ltable.c
gcc -O2 -Wall -DLUA_ANSI -c -o ltm.o ltm.c
gcc -O2 -Wall -DLUA_ANSI -c -o lundump.o lundump.c
gcc -O2 -Wall -DLUA_ANSI -c -o lvm.o lvm.c
gcc -O2 -Wall -DLUA_ANSI -c -o lzio.o lzio.c
gcc -O2 -Wall -DLUA_ANSI -c -o strbuf.o strbuf.c
gcc -O2 -Wall -DLUA_ANSI -c -o lauxlib.o lauxlib.c
gcc -O2 -Wall -DLUA_ANSI -c -o lbaselib.o lbaselib.c
gcc -O2 -Wall -DLUA_ANSI -c -o ldblib.o ldblib.c
gcc -O2 -Wall -DLUA_ANSI -c -o liolib.o liolib.c
gcc -O2 -Wall -DLUA_ANSI -c -o lmathlib.o lmathlib.c
gcc -O2 -Wall -DLUA_ANSI -c -o loslib.o loslib.c
gcc -O2 -Wall -DLUA_ANSI -c -o ltablib.o ltablib.c
gcc -O2 -Wall -DLUA_ANSI -c -o lstrlib.o lstrlib.c
gcc -O2 -Wall -DLUA_ANSI -c -o loadlib.o loadlib.c
gcc -O2 -Wall -DLUA_ANSI -c -o linit.o linit.c
gcc -O2 -Wall -DLUA_ANSI -c -o lua_cjson.o lua_cjson.c
gcc -O2 -Wall -DLUA_ANSI -c -o lua_struct.o lua_struct.c
gcc -O2 -Wall -DLUA_ANSI -c -o lua_cmsgpack.o lua_cmsgpack.c
ar rcu liblua.a lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem. ring.o ltable.o ltm.o lundump.o lvm.o lzio.o strbuf.o lauxlib.o lbaselib.o ldbli trlib.o loadlib.o linit.o lua_cjson.o lua_struct.o lua_cmsgpack.o
ranlib liblua.a
gcc -O2 -Wall -DLUA_ANSI -c -o lua.o lua.c
gcc -o lua lua.o liblua.a -lm
liblua.a(loslib.o): In function `os_tmpname':
loslib.c:(.text+0x35): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
gcc -O2 -Wall -DLUA_ANSI -c -o luac.o luac.c
gcc -O2 -Wall -DLUA_ANSI -c -o print.o print.c
gcc -o luac luac.o print.o liblua.a -lm
make[3]: Leaving directory `/users/denver/yyang/study/redis/redis-2.6.10/deps/lua/src'
MAKE jemalloc
cd jemalloc && ./configure --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS="-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops " LDFLAGS=""
checking for xsltproc... /usr/bin/xsltproc
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking size of void *... 8
checking size of int... 4
checking size of long... 8
checking size of intmax_t... 8
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking whether __asm__ syntax is compilable... yes
checking whether __attribute__ syntax is compilable... yes
checking whether compiler supports -fvisibility=hidden... yes
checking whether compiler supports -Werror... yes
checking whether tls_model attribute is compilable... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking for ar... /usr/bin/ar
checking for ld... /usr/bin/ld
checking for autoconf... /usr/bin/autoconf
checking for memalign... yes
checking for valloc... yes
checking configured backtracing method... N/A
checking for sbrk... yes
checking whether utrace(2) is compilable... no
checking whether valgrind is compilable... no
checking STATIC_PAGE_SHIFT... 12
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for pthread_create in -lpthread... yes
checking for _malloc_thread_cleanup... no
checking for _pthread_mutex_init_calloc_cb... no
checking for TLS... yes
checking whether a program using ffsl is compilable... yes
checking whether atomic(9) is compilable... no
checking whether Darwin OSAtomic*() is compilable... no
checking whether to force 32-bit __sync_{add,sub}_and_fetch()... no
checking whether to force 64-bit __sync_{add,sub}_and_fetch()... no
checking whether Darwin OSSpin*() is compilable... no
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/html.xsl
config.status: creating doc/manpages.xsl
config.status: creating doc/jemalloc.xml
config.status: creating include/jemalloc/jemalloc.h
config.status: creating include/jemalloc/internal/jemalloc_internal.h
config.status: creating test/jemalloc_test.h
config.status: creating config.stamp
config.status: creating bin/jemalloc.sh
config.status: creating include/jemalloc/jemalloc_defs.h
config.status: executing include/jemalloc/internal/size_classes.h commands
===============================================================================
jemalloc version : 3.2.0-0-g87499f6748ebe4817571e817e9f680ccb5bf54a9
library revision : 1
CC : gcc
CPPFLAGS : -D_GNU_SOURCE -D_REENTRANT
CFLAGS : -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -fvisibility=hidden
LDFLAGS :
LIBS : -lm -lpthread
RPATH_EXTRA :
XSLTPROC : /usr/bin/xsltproc
XSLROOT : /usr/share/sgml/docbook/xsl-stylesheets
PREFIX : /usr/local
BINDIR : /usr/local/bin
INCLUDEDIR : /usr/local/include
LIBDIR : /usr/local/lib
DATADIR : /usr/local/share
MANDIR : /usr/local/share/man
srcroot :
abs_srcroot : /u1/yyang/study/redis/redis-2.6.10/deps/jemalloc/
objroot :
abs_objroot : /u1/yyang/study/redis/redis-2.6.10/deps/jemalloc/
JEMALLOC_PREFIX : je_
JEMALLOC_PRIVATE_NAMESPACE
:
install_suffix :
autogen : 0
experimental : 1
cc-silence : 1
debug : 0
stats : 1
prof : 0
prof-libunwind : 0
prof-libgcc : 0
prof-gcc : 0
tcache : 1
fill : 1
utrace : 0
valgrind : 0
xmalloc : 0
mremap : 0
munmap : 0
dss : 0
lazy_lock : 0
tls : 1
===============================================================================
cd jemalloc && make CFLAGS="-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops " LDFLAGS="" lib/libjemalloc.a
make[3]: Entering directory `/users/denver/yyang/study/redis/redis-2.6.10/deps/jemalloc'
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/jemalloc.o src/jemalloc.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/arena.o src/arena.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/atomic.o src/atomic.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/base.o src/base.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/bitmap.o src/bitmap.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/chunk.o src/chunk.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/chunk_dss.o src/chunk_dss.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/chunk_mmap.o src/chunk_mmap.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/ckh.o src/ckh.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/ctl.o src/ctl.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/extent.o src/extent.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/hash.o src/hash.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/huge.o src/huge.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/mb.o src/mb.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/mutex.o src/mutex.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/prof.o src/prof.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/quarantine.o src/quarantine.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/rtree.o src/rtree.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/stats.o src/stats.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tcache.o src/tcache.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/util.o src/util.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tsd.o src/tsd.c
ar crus lib/libjemalloc.a src/jemalloc.o src/arena.o src/atomic.o src/base.o src/bitmap.o src/chunk.o src/chunk_dss.o src/chunk_mmap.o src/ckh.o src/ctl.o src/extent.o src/hash.o src/huge.o src/mb.o src/mutex.o src/prof.o src/quarantine.o src/rtree.o src/stats.o src/tcache.o src/util.o src/tsd.o
make[3]: Leaving directory `/users/denver/yyang/study/redis/redis-2.6.10/deps/jemalloc'
make[2]: Leaving directory `/users/denver/yyang/study/redis/redis-2.6.10/deps'
CC adlist.o
CC ae.o
CC anet.o
CC dict.o
CC redis.o
CC sds.o
CC zmalloc.o
CC lzf_c.o
CC lzf_d.o
CC pqsort.o
CC zipmap.o
CC sha1.o
CC ziplist.o
CC release.o
CC networking.o
CC util.o
CC object.o
CC db.o
CC replication.o
CC rdb.o
CC t_string.o
CC t_list.o
CC t_set.o
CC t_zset.o
CC t_hash.o
CC config.o
CC aof.o
CC pubsub.o
CC multi.o
CC debug.o
CC sort.o
CC intset.o
CC syncio.o
CC migrate.o
CC endianconv.o
CC slowlog.o
CC scripting.o
CC bio.o
CC rio.o
CC rand.o
CC memtest.o
CC crc64.o
CC bitops.o
CC sentinel.o
LINK redis-server
INSTALL redis-sentinel
CC redis-cli.o
LINK redis-cli
CC redis-benchmark.o
LINK redis-benchmark
CC redis-check-dump.o
LINK redis-check-dump
CC redis-check-aof.o
LINK redis-check-aof
Hint: To run 'make test' is a good idea ;)
make[1]: Leaving directory `/users/denver/yyang/study/redis/redis-2.6.10/src'
build 成功后在目录/u1/yyang/study/redis/redis-2.6.10/src下生成几个二进制文件如下:
[/u1/yyang/study/redis/redis-2.6.10/src](121)yyang@dcmvrh12#ll -tr redis-sentinel redis-server redis-cli redis-benchmark redis-check-dump redis-check-aof
-rwxrwxr-x 1 yyang clearusr 5485952 Nov 11 04:42 redis-server*
-rwxrwxr-x 1 yyang clearusr 5485952 Nov 11 04:42 redis-sentinel*
-rwxrwxr-x 1 yyang clearusr 4220050 Nov 11 04:42 redis-cli*
-rwxrwxr-x 1 yyang clearusr 4160143 Nov 11 04:42 redis-benchmark*
-rwxrwxr-x 1 yyang clearusr 45475 Nov 11 04:42 redis-check-dump*
-rwxrwxr-x 1 yyang clearusr 22233 Nov 11 04:42 redis-check-aof*
-rwxrwxr-x 1 yyang clearusr 22233 Nov 11 04:42 redis-check-aof*
redis-server:Redis服务器的daemon启动程序
redis-cli:Redis命令行操作工具。当然,你也可以用telnet根据其纯文本协议来操作
redis-benchmark:Redis性能测试工具,测试Redis在你的系统及你的配置下的读写性能
redis-stat:Redis状态检测工具,可以检测Redis当前状态参数及延迟状况
4.redis 配置文件详解
在我们成功安装Redis后,我们直接执行redis-server即可运行Redis,此时它是按照默认配置来运行的(默认配置甚至不是后台运行)。我们希望Redis按我们的要求运行,则我们需要修改配置文件,Redis的配置文件就是redis.conf文件。
[/u1/yyang/study/redis/redis-2.6.10] (116)yyang@dcmvrh12#ll redis.conf
-rw-rw-r-- 1 yyang clearusr 24476 Nov 11 05:11 redis.conf
这里我们只修改它为后台进程
daemonize yes
5.run
后台启动redis服务
[/u1/yyang/study/redis/redis-2.6.10/src](122)yyang@dcmvrh12#redis-server/u1/yyang/study/redis/redis-2.6.10/redis.conf
[/u1/yyang/study/redis/redis-2.6.10/src](123)yyang@dcmvrh12#ps -ef|grep redis-server
yyang 22810 1 0 05:16 ? 00:00:00 redis-server/u1/yyang/study/redis/redis-2.6.10/redis.conf
yyang 22908 27858 0 05:16 pts/74 00:00:00 egrep redis-server
如果没有启动client的话可以用telenet,但是很丑,不舒服,界面如下:
[/u1/yyang/study/redis/redis-2.6.10/src] (124)yyang@dcmvrh12#telnet 127.0.0.1 6379
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
quit
启动client:
[/u1/yyang/study/redis/redis-2.6.10/src] (127)yyang@dcmvrh12#redis-cli
redis 127.0.0.1:6379>
然后你就可以进行操作了比如:
[/u1/yyang/study/redis/redis-2.6.10/src] (127)yyang@dcmvrh12#redis-cli
redis 127.0.0.1:6379>set mykey "hello world"
OK
redis 127.0.0.1:6379> get mykey
"hello world"
redis 127.0.0.1:6379>
好了,成功!yeah