ITPub博客

首页 > 数据库 > NoSQL > redis 介绍及安装【一】

redis 介绍及安装【一】

原创 NoSQL 作者:哎呀我的天呐 时间:2015-08-17 14:13:24 0 删除 编辑
redis官网:http://redis.io/

Redis is an open source, BSD licensed, advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.
Redis是开源BSD许可,高级的key-value存储缓存系统,可以用来存储字符串,哈西结构(链表,集合,因此常用来做数据结构服务器)

Redis和memcached相比的独特之处:
1.redis可以用来做存储,而memcached用来做缓存。可以用来持久化
2.存储的数据有“结构”,对于memcached来说存储的数据结构只有1种字符串。而redis则可以存字符串,链表,hash结构,集合及有序集合。

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
安装:

我们进去redis官网,查找最新稳定(stable)版

Download it

Redis 3.0.3 is the latest stable version.


上传解压

点击(此处)折叠或打开

  1. [root@MysqlPri redis]# gunzip redis-3.0.3.tar.gz
  2. [root@MysqlPri redis]# ls
  3. redis-3.0.3.tar
  4. [root@MysqlPri redis]# ls -l
  5. total 5892
  6. -rw-r--r--. 1 root root 6031360 Aug 16 2015 redis-3.0.3.tar
  7. [root@MysqlPri redis]# tar -xvf redis-3.0.3.tar
  8. redis-3.0.3/
  9. redis-3.0.3/.gitignore
  10. ... ...
cd安装目录

点击(此处)折叠或打开

  1. [root@MysqlPri redis]# cd redis-3.0.3
  2. [root@MysqlPri redis-3.0.3]# ls
  3. 00-RELEASENOTES CONTRIBUTING deps Makefile README runtest runtest-sentinel src utils
  4. BUGS COPYING INSTALL MANIFESTO redis.conf runtest-cluster sentinel.conf tests
  5. [root@MysqlPri redis-3.0.3]# ls -l
  6. total 144
  7. -rw-rw-r--. 1 root root 28290 Jul 17 17:50 00-RELEASENOTES
  8. -rw-rw-r--. 1 root root 53 Jul 17 17:50 BUGS
  9. -rw-rw-r--. 1 root root 1439 Jul 17 17:50 CONTRIBUTING
  10. -rw-rw-r--. 1 root root 1487 Jul 17 17:50 COPYING
  11. drwxrwxr-x. 6 root root 4096 Jul 17 17:50 deps
  12. -rw-rw-r--. 1 root root 11 Jul 17 17:50 INSTALL
  13. -rw-rw-r--. 1 root root 151 Jul 17 17:50 Makefile
  14. -rw-rw-r--. 1 root root 4223 Jul 17 17:50 MANIFESTO
  15. -rw-rw-r--. 1 root root 5201 Jul 17 17:50 README
  16. -rw-rw-r--. 1 root root 41403 Jul 17 17:50 redis.conf
  17. -rwxrwxr-x. 1 root root 271 Jul 17 17:50 runtest
  18. -rwxrwxr-x. 1 root root 280 Jul 17 17:50 runtest-cluster
  19. -rwxrwxr-x. 1 root root 281 Jul 17 17:50 runtest-sentinel
  20. -rw-rw-r--. 1 root root 7109 Jul 17 17:50 sentinel.conf
  21. drwxrwxr-x. 2 root root 4096 Jul 17 17:50 src
  22. drwxrwxr-x. 10 root root 4096 Jul 17 17:50 tests
  23. drwxrwxr-x. 5 root root 4096 Jul 17 17:50 utils
make
这里可能有一种错误就是你的系统时间比redis出场的的时间还要早,

点击(此处)折叠或打开

  1. [root@MysqlPri redis-3.0.3]# make
  2. cd src && make all
  3. make[1]: Entering directory `/redis/redis-3.0.3/src'
  4. rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-dump redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html
  5. (cd ../deps && make distclean)
  6. make[2]: Entering directory `/redis/redis-3.0.3/deps'
  7. (cd hiredis && make clean) > /dev/null || true
  8. (cd linenoise && make clean) > /dev/null || true
  9. (cd lua && make clean) > /dev/null || true
  10. (cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
  11. (rm -f .make-*)
  12. make[2]: Leaving directory `/redis/redis-3.0.3/deps'
  13. (rm -f .make-*)
  14. echo STD=-std=c99 -pedantic >> .make-settings
  15. echo WARN=-Wall -W >> .make-settings
  16. echo OPT=-O2 >> .make-settings
  17. echo MALLOC=jemalloc >> .make-settings
  18. echo CFLAGS= >> .make-settings
  19. echo LDFLAGS= >> .make-settings
  20. echo REDIS_CFLAGS= >> .make-settings
  21. echo REDIS_LDFLAGS= >> .make-settings
  22. echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -Wall -W -O2 -g -ggdb -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
  23. echo PREV_FINAL_LDFLAGS= -g -ggdb -rdynamic >> .make-settings
  24. (cd ../deps && make hiredis linenoise lua jemalloc)
  25. make[2]: Entering directory `/redis/redis-3.0.3/deps'
  26. (cd hiredis && make clean) > /dev/null || true
  27. (cd linenoise && make clean) > /dev/null || true
  28. (cd lua && make clean) > /dev/null || true
  29. (cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
  30. (rm -f .make-*)
  31. (echo "" > .make-ldflags)
  32. (echo "" > .make-cflags)
  33. MAKE hiredis
  34. cd hiredis && make static
  35. make[3]: Entering directory `/redis/redis-3.0.3/deps/hiredis'
  36. cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
  37. cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb hiredis.c
  38. cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb sds.c
  39. cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb async.c
  40. ar rcs libhiredis.a net.o hiredis.o sds.o async.o
  41. make[3]: Leaving directory `/redis/redis-3.0.3/deps/hiredis'
  42. MAKE linenoise
  43. cd linenoise && make
  44. make[3]: Entering directory `/redis/redis-3.0.3/deps/linenoise'
  45. cc -Wall -Os -g -c linenoise.c
  46. make[3]: Leaving directory `/redis/redis-3.0.3/deps/linenoise'
  47. MAKE lua
  48. cd lua/src && make all CFLAGS="-O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL " MYLDFLAGS="" AR="ar rcu"
  49. make[3]: Entering directory `/redis/redis-3.0.3/deps/lua/src'
  50. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lapi.o lapi.c
  51. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lcode.o lcode.c
  52. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ldebug.o ldebug.c
  53. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ldo.o ldo.c
  54. ldo.c: In function ?._parser?.
  55. ldo.c:496: warning: unused variable ?.?
  56. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ldump.o ldump.c
  57. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lfunc.o lfunc.c
  58. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lgc.o lgc.c
  59. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o llex.o llex.c
  60. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lmem.o lmem.c
  61. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lobject.o lobject.c
  62. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lopcodes.o lopcodes.c
  63. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lparser.o lparser.c
  64. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lstate.o lstate.c
  65. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lstring.o lstring.c
  66. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ltable.o ltable.c
  67. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ltm.o ltm.c
  68. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lundump.o lundump.c
  69. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lvm.o lvm.c
  70. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lzio.o lzio.c
  71. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o strbuf.o strbuf.c
  72. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o fpconv.o fpconv.c
  73. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lauxlib.o lauxlib.c
  74. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lbaselib.o lbaselib.c
  75. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ldblib.o ldblib.c
  76. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o liolib.o liolib.c
  77. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lmathlib.o lmathlib.c
  78. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o loslib.o loslib.c
  79. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ltablib.o ltablib.c
  80. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lstrlib.o lstrlib.c
  81. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o loadlib.o loadlib.c
  82. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o linit.o linit.c
  83. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lua_cjson.o lua_cjson.c
  84. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lua_struct.o lua_struct.c
  85. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lua_cmsgpack.o lua_cmsgpack.c
  86. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lua_bit.o lua_bit.c
  87. ar rcu liblua.a lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o strbuf.o fpconv.o lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o loadlib.o linit.o lua_cjson.o lua_struct.o lua_cmsgpack.o lua_bit.o    # DLL needs all object files
  88. ranlib liblua.a
  89. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lua.o lua.c
  90. cc -o lua lua.o liblua.a -lm
  91. liblua.a(loslib.o): In function `os_tmpname':
  92. loslib.c:(.text+0x35): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
  93. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o luac.o luac.c
  94. cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o print.o print.c
  95. cc -o luac luac.o print.o liblua.a -lm
  96. make[3]: Leaving directory `/redis/redis-3.0.3/deps/lua/src'
  97. MAKE jemalloc
  98. cd jemalloc && ./configure --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS="-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops " LDFLAGS=""
  99. checking for xsltproc... /usr/bin/xsltproc
  100. checking for gcc... gcc
  101. checking whether the C compiler works... yes
  102. checking for C compiler default output file name... a.out
  103. checking for suffix of executables...
  104. checking whether we are cross compiling... no
  105. checking for suffix of object files... o
  106. checking whether we are using the GNU C compiler... yes
  107. checking whether gcc accepts -g... yes
  108. checking for gcc option to accept ISO C89... none needed
  109. checking how to run the C preprocessor... gcc -E
  110. checking for grep that handles long lines and -e... /bin/grep
  111. checking for egrep... /bin/grep -E
  112. checking for ANSI C header files... yes
  113. checking for sys/types.h... yes
  114. checking for sys/stat.h... yes
  115. checking for stdlib.h... yes
  116. checking for string.h... yes
  117. checking for memory.h... yes
  118. checking for strings.h... yes
  119. checking for inttypes.h... yes
  120. checking for stdint.h... yes
  121. checking for unistd.h... yes
  122. checking whether byte ordering is bigendian... no
  123. checking size of void *... 8
  124. checking size of int... 4
  125. checking size of long... 8
  126. checking size of intmax_t... 8
  127. checking build system type... x86_64-unknown-linux-gnu
  128. checking host system type... x86_64-unknown-linux-gnu
  129. checking whether pause instruction is compilable... yes
  130. checking whether SSE2 intrinsics is compilable... yes
  131. checking for ar... ar
  132. checking whether __attribute__ syntax is compilable... yes
  133. checking whether compiler supports -fvisibility=hidden... yes
  134. checking whether compiler supports -Werror... yes
  135. checking whether tls_model attribute is compilable... yes
  136. checking for a BSD-compatible install... /usr/bin/install -c
  137. checking for ranlib... ranlib
  138. checking for ld... /usr/bin/ld
  139. checking for autoconf... false
  140. checking for memalign... yes
  141. checking for valloc... yes
  142. checking configured backtracing method... N/A
  143. checking for sbrk... yes
  144. checking whether utrace(2) is compilable... no
  145. checking whether valgrind is compilable... no
  146. checking STATIC_PAGE_SHIFT... 12
  147. checking pthread.h usability... yes
  148. checking pthread.h presence... yes
  149. checking for pthread.h... yes
  150. checking for pthread_create in -lpthread... yes
  151. checking for _malloc_thread_cleanup... no
  152. checking for _pthread_mutex_init_calloc_cb... no
  153. checking for TLS... yes
  154. checking whether a program using ffsl is compilable... yes
  155. checking whether atomic(9) is compilable... no
  156. checking whether Darwin OSAtomic*() is compilable... no
  157. checking whether to force 32-bit __sync_{add,sub}_and_fetch()... no
  158. checking whether to force 64-bit __sync_{add,sub}_and_fetch()... no
  159. checking whether Darwin OSSpin*() is compilable... no
  160. checking for stdbool.h that conforms to C99... yes
  161. checking for _Bool... yes
  162. configure: creating ./config.status
  163. config.status: creating Makefile
  164. config.status: creating doc/html.xsl
  165. config.status: creating doc/manpages.xsl
  166. config.status: creating doc/jemalloc.xml
  167. config.status: creating include/jemalloc/jemalloc_macros.h
  168. config.status: creating include/jemalloc/jemalloc_protos.h
  169. config.status: creating include/jemalloc/internal/jemalloc_internal.h
  170. config.status: creating test/test.sh
  171. config.status: creating test/include/test/jemalloc_test.h
  172. config.status: creating config.stamp
  173. config.status: creating bin/jemalloc.sh
  174. config.status: creating include/jemalloc/jemalloc_defs.h
  175. config.status: creating include/jemalloc/internal/jemalloc_internal_defs.h
  176. config.status: creating test/include/test/jemalloc_test_defs.h
  177. config.status: executing include/jemalloc/internal/private_namespace.h commands
  178. config.status: executing include/jemalloc/internal/private_unnamespace.h commands
  179. config.status: executing include/jemalloc/internal/public_symbols.txt commands
  180. config.status: executing include/jemalloc/internal/public_namespace.h commands
  181. config.status: executing include/jemalloc/internal/public_unnamespace.h commands
  182. config.status: executing include/jemalloc/internal/size_classes.h commands
  183. config.status: executing include/jemalloc/jemalloc_protos_jet.h commands
  184. config.status: executing include/jemalloc/jemalloc_rename.h commands
  185. config.status: executing include/jemalloc/jemalloc_mangle.h commands
  186. config.status: executing include/jemalloc/jemalloc_mangle_jet.h commands
  187. config.status: executing include/jemalloc/jemalloc.h commands
  188. ===============================================================================
  189. jemalloc version : 3.6.0-0-g46c0af68bd248b04df75e4f92d5fb804c3d75340
  190. library revision : 1

  191. CC : gcc
  192. CPPFLAGS : -D_GNU_SOURCE -D_REENTRANT
  193. CFLAGS : -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -fvisibility=hidden
  194. LDFLAGS :
  195. EXTRA_LDFLAGS :
  196. LIBS : -lpthread
  197. RPATH_EXTRA :

  198. XSLTPROC : /usr/bin/xsltproc
  199. XSLROOT : /usr/share/sgml/docbook/xsl-stylesheets

  200. PREFIX : /usr/local
  201. BINDIR : /usr/local/bin
  202. INCLUDEDIR : /usr/local/include
  203. LIBDIR : /usr/local/lib
  204. DATADIR : /usr/local/share
  205. MANDIR : /usr/local/share/man

  206. srcroot :
  207. abs_srcroot : /redis/redis-3.0.3/deps/jemalloc/
  208. objroot :
  209. abs_objroot : /redis/redis-3.0.3/deps/jemalloc/

  210. JEMALLOC_PREFIX : je_
  211. JEMALLOC_PRIVATE_NAMESPACE
  212.                    : je_
  213. install_suffix :
  214. autogen : 0
  215. experimental : 1
  216. cc-silence : 1
  217. debug : 0
  218. code-coverage : 0
  219. stats : 1
  220. prof : 0
  221. prof-libunwind : 0
  222. prof-libgcc : 0
  223. prof-gcc : 0
  224. tcache : 1
  225. fill : 1
  226. utrace : 0
  227. valgrind : 0
  228. xmalloc : 0
  229. mremap : 0
  230. munmap : 0
  231. dss : 0
  232. lazy_lock : 0
  233. tls : 1
  234. ===============================================================================
  235. cd jemalloc && make CFLAGS="-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops " LDFLAGS="" lib/libjemalloc.a
  236. make[3]: Entering directory `/redis/redis-3.0.3/deps/jemalloc'
  237. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/jemalloc.o src/jemalloc.c
  238. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/arena.o src/arena.c
  239. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/atomic.o src/atomic.c
  240. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/base.o src/base.c
  241. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/bitmap.o src/bitmap.c
  242. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/chunk.o src/chunk.c
  243. 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
  244. 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
  245. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/ckh.o src/ckh.c
  246. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/ctl.o src/ctl.c
  247. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/extent.o src/extent.c
  248. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/hash.o src/hash.c
  249. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/huge.o src/huge.c
  250. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/mb.o src/mb.c
  251. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/mutex.o src/mutex.c
  252. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/prof.o src/prof.c
  253. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/quarantine.o src/quarantine.c
  254. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/rtree.o src/rtree.c
  255. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/stats.o src/stats.c
  256. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tcache.o src/tcache.c
  257. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/util.o src/util.c
  258. gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tsd.o src/tsd.c
  259. 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
  260. make[3]: Leaving directory `/redis/redis-3.0.3/deps/jemalloc'
  261. make[2]: Leaving directory `/redis/redis-3.0.3/deps'
  262.     CC adlist.o
  263.     CC ae.o
  264.     CC anet.o
  265. anet.c: In function ?.netSockName?.
  266. anet.c:623: warning: dereferencing pointer ?.?.does break strict-aliasing rules
  267. anet.c:621: note: initialized from here
  268. anet.c:627: warning: dereferencing pointer ?.?.does break strict-aliasing rules
  269. anet.c:625: note: initialized from here
  270. anet.c: In function ?.netPeerToString?.
  271. anet.c:584: warning: dereferencing pointer ?.?.does break strict-aliasing rules
  272. anet.c:582: note: initialized from here
  273. anet.c:588: warning: dereferencing pointer ?.?.does break strict-aliasing rules
  274. anet.c:586: note: initialized from here
  275. anet.c: In function ?.netTcpAccept?.
  276. anet.c:555: warning: dereferencing pointer ?.?.does break strict-aliasing rules
  277. anet.c:553: note: initialized from here
  278. anet.c:559: warning: dereferencing pointer ?.?.does break strict-aliasing rules
  279. anet.c:557: note: initialized from here
  280.     CC dict.o
  281.     CC redis.o
  282.     CC sds.o
  283.     CC zmalloc.o
  284.     CC lzf_c.o
  285.     CC lzf_d.o
  286.     CC pqsort.o
  287.     CC zipmap.o
  288.     CC sha1.o
  289.     CC ziplist.o
  290.     CC release.o
  291.     CC networking.o
  292.     CC util.o
  293.     CC object.o
  294.     CC db.o
  295. db.c: In function ?.canGenericCommand?.
  296. db.c:432: warning: ?.at?.may be used uninitialized in this function
  297. db.c:433: warning: ?.atlen?.may be used uninitialized in this function
  298.     CC replication.o
  299.     CC rdb.o
  300.     CC t_string.o
  301.     CC t_list.o
  302.     CC t_set.o
  303.     CC t_zset.o
  304.     CC t_hash.o
  305.     CC config.o
  306.     CC aof.o
  307.     CC pubsub.o
  308.     CC multi.o
  309.     CC debug.o
  310.     CC sort.o
  311.     CC intset.o
  312.     CC syncio.o
  313.     CC cluster.o
  314.     CC crc16.o
  315.     CC endianconv.o
  316.     CC slowlog.o
  317.     CC scripting.o
  318.     CC bio.o
  319.     CC rio.o
  320.     CC rand.o
  321.     CC memtest.o
  322.     CC crc64.o
  323.     CC bitops.o
  324.     CC sentinel.o
  325.     CC notify.o
  326.     CC setproctitle.o
  327.     CC blocked.o
  328.     CC hyperloglog.o
  329.     CC latency.o
  330.     CC sparkline.o
  331.     LINK redis-server
  332.     INSTALL redis-sentinel
  333.     CC redis-cli.o
  334.     LINK redis-cli
  335.     CC redis-benchmark.o
  336.     LINK redis-benchmark
  337.     CC redis-check-dump.o
  338.     LINK redis-check-dump
  339.     CC redis-check-aof.o
  340.     LINK redis-check-aof

  341. Hint: It's a good idea to run 'make test' ;)

  342. make[1]: Leaving directory `/redis/redis-3.0.3/src'
make test一下,看有没有错误
其中报一个错如下:
Detect write load to master in tests/integration/replication-psync.tcl

查找了下,可能是虚拟机配置低,一些处理超时引起。

指定目录安装:

点击(此处)折叠或打开

  1. [root@MysqlPri redis-3.0.3]# make PREFIX=/redis install
  2. cd src && make install
  3. make[1]: Entering directory `/redis/redis-3.0.3/src'

  4. Hint: It's a good idea to run 'make test' ;)

  5.     INSTALL install
  6.     INSTALL install
  7.     INSTALL install
  8.     INSTALL install
  9.     INSTALL install
  10. make[1]: Leaving directory `/redis/redis-3.0.3/src
非常简洁,只是在安装目录下多了bin目录

点击(此处)折叠或打开

  1. [root@MysqlPri redis]# ls -l
  2. total 8
  3. drwxr-xr-x. 2 root root 4096 Aug 1 18:46 bin
  4. drwxrwxr-x. 6 root root 4096 Jul 17 17:50 redis-3.0.3
bin下的命令是什么意思呢?下面我们来说一说~

点击(此处)折叠或打开

  1. -rwxr-xr-x. 1 root root 4587387 Aug 1 18:46 redis-benchmark
  2. -rwxr-xr-x. 1 root root 22217 Aug 1 18:46 redis-check-aof
  3. -rwxr-xr-x. 1 root root 45435 Aug 1 18:46 redis-check-dump
  4. -rwxr-xr-x. 1 root root 4690470 Aug 1 18:46 redis-cli
  5. lrwxrwxrwx. 1 root root 12 Aug 1 18:46 redis-sentinel -> redis-server
  6. -rwxr-xr-x. 1 root root 6458159 Aug 1 18:46 redis-server

redis-benchmark  ---->redis性能测试工具
redis-check-aof    ---->检查aof日志工具,如果日志损坏能检查出来
redis-check-dump---->检查rdb日志工具
redis-cli               ---->连接用的客户端
redis-server         ---->redis服务区进程

将redis-3.0.3目录下的配置文件redis.conf拷贝到安装目录,如下:

点击(此处)折叠或打开

  1. drwxr-xr-x. 2 root root 4096 Aug 1 18:46 bin
  2. drwxrwxr-x. 6 root root 4096 Jul 17 17:50 redis-3.0.3
  3. -rw-r--r--. 1 root root 41403 Aug 1 18:56 redis.conf
启动并连接redis


可以看出默认端口是6379,并且现在的启动不是后台启动。

下面我们改redis配置文件让其后台运行
vim redis.conf 设置 daemonize no-->daemonize yes

点击(此处)折叠或打开

  1. [root@MysqlPri redis]# ./bin/redis-server ./redis.conf
  2. [root@MysqlPri redis]# ps -ef | grep red
  3. root 13506 11925 0 19:03 pts/3 00:00:00 ./redis-cli
  4. root 13527 1 0 19:11 ? 00:00:00 ./bin/redis-server *:6379
  5. root 13531 8238 0 19:11 pts/2 00:00:00 grep red
进入client测试简单命令

点击(此处)折叠或打开

  1. [root@MysqlPri redis]# cd bin/
  2. [root@MysqlPri bin]# ./redis-cli
  3. 127.0.0.1:6379> set site www.redis.io
  4. OK
  5. 127.0.0.1:6379> get site
  6. "www.redis.io"
当服务停止的时候,没有持久化的话site就丢失了..... ........ 。。。。。。。


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29990276/viewspace-1774038/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: MYSQL字符集 【1】
请登录后发表评论 登录
全部评论
https://cloud.tencent.com/developer/inventory/14362

注册时间:2014-10-30

  • 博文量
    403
  • 访问量
    2528734