Redis安装与卸载
Redis是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,
并提供多种语言的API。它支持丰富的数据类型,和高速的内存读写。正在逐步取代memcached的地位。
下面就演示下在centos6.9的32位下的安装配置过程。
1、安装
2、配置
3、卸载
①我们可以通过在官网下载tar.gz的安装包,或者通过wget的方式下载
[root@localhost data]# wget http://download.redis.io/releases/redis-4.0.1.tar.gz --2017-09-03 09:51:27-- http://download.redis.io/releases/redis-4.0.1.tar.gz 正在解析主机 download.redis.io... 109.74.203.151 正在连接 download.redis.io|109.74.203.151|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:1711660 (1.6M) [application/x-gzip] 正在保存至: “redis-4.0.1.tar.gz” 57% [=====================================> ] 981,091 298K/s eta(英国中部时
64% [==========================================> ] 1,105,869 309K/s eta(英国中部时
72% [===============================================> ] 1,237,657 321K/s eta(英国中部时
80% [====================================================> ] 1,376,455 334K/s eta(英国中部时
86% [========================================================> ] 1,478,801 341K/s eta(英国中部时
92% [============================================================> ] 1,582,549 349K/s eta(英国中部时
100%[==================================================================>] 1,711,660 380K/s in 4.6s 2017-09-03 09:51:32 (363 KB/s) - 已保存 “redis-4.0.1.tar.gz” [1711660/1711660]) [root@localhost data]#
②解压
[root@localhost data]# ll 总用量 1672 -rw-r--r--. 1 root root 1711660 7月 24 22:59 redis-4.0.1.tar.gz [root@localhost data]# tar -zxvf redis-4.0.1.tar.gz redis-4.0.1/ redis-4.0.1/.gitignore redis-4.0.1/00-RELEASENOTES redis-4.0.1/BUGS redis-4.0.1/CONTRIBUTING redis-4.0.1/COPYING redis-4.0.1/INSTALL redis-4.0.1/MANIFESTO redis-4.0.1/Makefile redis-4.0.1/README.md redis-4.0.1/deps/ redis-4.0.1/deps/Makefile redis-4.0.1/deps/README.md redis-4.0.1/deps/hiredis/ redis-4.0.1/deps/hiredis/.gitignore redis-4.0.1/deps/hiredis/.travis.yml redis-4.0.1/deps/hiredis/CHANGELOG.md redis-4.0.1/deps/hiredis/COPYING redis-4.0.1/deps/hiredis/Makefile redis-4.0.1/deps/hiredis/README.md redis-4.0.1/deps/hiredis/adapters/ redis-4.0.1/deps/hiredis/adapters/ae.h redis-4.0.1/deps/hiredis/adapters/glib.h redis-4.0.1/deps/hiredis/adapters/ivykis.h redis-4.0.1/deps/hiredis/adapters/libev.h redis-4.0.1/deps/hiredis/adapters/libevent.h redis-4.0.1/deps/hiredis/adapters/libuv.h redis-4.0.1/deps/hiredis/adapters/macosx.h redis-4.0.1/deps/hiredis/adapters/qt.h redis-4.0.1/deps/hiredis/appveyor.yml redis-4.0.1/deps/hiredis/async.c redis-4.0.1/deps/hiredis/async.h redis-4.0.1/deps/hiredis/dict.c redis-4.0.1/deps/hiredis/dict.h redis-4.0.1/deps/hiredis/examples/ redis-4.0.1/deps/hiredis/examples/example-ae.c redis-4.0.1/deps/hiredis/examples/example-glib.c redis-4.0.1/deps/hiredis/examples/example-ivykis.c redis-4.0.1/deps/hiredis/examples/example-libev.c redis-4.0.1/deps/hiredis/examples/example-libevent.c redis-4.0.1/deps/hiredis/examples/example-libuv.c redis-4.0.1/deps/hiredis/examples/example-macosx.c redis-4.0.1/deps/hiredis/examples/example-qt.cpp redis-4.0.1/deps/hiredis/examples/example-qt.h redis-4.0.1/deps/hiredis/examples/example.c redis-4.0.1/deps/hiredis/fmacros.h redis-4.0.1/deps/hiredis/hiredis.c redis-4.0.1/deps/hiredis/hiredis.h redis-4.0.1/deps/hiredis/net.c redis-4.0.1/deps/hiredis/net.h redis-4.0.1/deps/hiredis/read.c redis-4.0.1/deps/hiredis/read.h redis-4.0.1/deps/hiredis/sds.c redis-4.0.1/deps/hiredis/sds.h redis-4.0.1/deps/hiredis/sdsalloc.h redis-4.0.1/deps/hiredis/test.c redis-4.0.1/deps/hiredis/win32.h redis-4.0.1/deps/jemalloc/ redis-4.0.1/deps/jemalloc/.autom4te.cfg redis-4.0.1/deps/jemalloc/.gitattributes redis-4.0.1/deps/jemalloc/.gitignore redis-4.0.1/deps/jemalloc/COPYING redis-4.0.1/deps/jemalloc/ChangeLog redis-4.0.1/deps/jemalloc/INSTALL redis-4.0.1/deps/jemalloc/Makefile.in redis-4.0.1/deps/jemalloc/README redis-4.0.1/deps/jemalloc/VERSION redis-4.0.1/deps/jemalloc/autogen.sh redis-4.0.1/deps/jemalloc/bin/ redis-4.0.1/deps/jemalloc/bin/jemalloc-config.in redis-4.0.1/deps/jemalloc/bin/jemalloc.sh.in redis-4.0.1/deps/jemalloc/bin/jeprof.in redis-4.0.1/deps/jemalloc/config.guess redis-4.0.1/deps/jemalloc/config.stamp.in redis-4.0.1/deps/jemalloc/config.sub redis-4.0.1/deps/jemalloc/configure redis-4.0.1/deps/jemalloc/configure.ac redis-4.0.1/deps/jemalloc/coverage.sh redis-4.0.1/deps/jemalloc/doc/ redis-4.0.1/deps/jemalloc/doc/html.xsl.in redis-4.0.1/deps/jemalloc/doc/jemalloc.3 redis-4.0.1/deps/jemalloc/doc/jemalloc.html redis-4.0.1/deps/jemalloc/doc/jemalloc.xml.in redis-4.0.1/deps/jemalloc/doc/manpages.xsl.in redis-4.0.1/deps/jemalloc/doc/stylesheet.xsl redis-4.0.1/deps/jemalloc/include/ redis-4.0.1/deps/jemalloc/include/jemalloc/ redis-4.0.1/deps/jemalloc/include/jemalloc/internal/ redis-4.0.1/deps/jemalloc/include/jemalloc/internal/arena.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/atomic.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/base.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/bitmap.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/chunk.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/chunk_dss.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/chunk_mmap.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/ckh.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/ctl.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/extent.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/hash.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/huge.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in redis-4.0.1/deps/jemalloc/include/jemalloc/internal/jemalloc_internal_decls.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h.in redis-4.0.1/deps/jemalloc/include/jemalloc/internal/jemalloc_internal_macros.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/mb.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/mutex.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/pages.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/private_namespace.sh redis-4.0.1/deps/jemalloc/include/jemalloc/internal/private_symbols.txt redis-4.0.1/deps/jemalloc/include/jemalloc/internal/private_unnamespace.sh redis-4.0.1/deps/jemalloc/include/jemalloc/internal/prng.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/prof.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/public_namespace.sh redis-4.0.1/deps/jemalloc/include/jemalloc/internal/public_unnamespace.sh redis-4.0.1/deps/jemalloc/include/jemalloc/internal/ql.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/qr.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/quarantine.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/rb.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/rtree.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/size_classes.sh redis-4.0.1/deps/jemalloc/include/jemalloc/internal/stats.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/tcache.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/tsd.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/util.h redis-4.0.1/deps/jemalloc/include/jemalloc/internal/valgrind.h redis-4.0.1/deps/jemalloc/include/jemalloc/jemalloc.sh redis-4.0.1/deps/jemalloc/include/jemalloc/jemalloc_defs.h.in redis-4.0.1/deps/jemalloc/include/jemalloc/jemalloc_macros.h.in redis-4.0.1/deps/jemalloc/include/jemalloc/jemalloc_mangle.sh redis-4.0.1/deps/jemalloc/include/jemalloc/jemalloc_protos.h.in redis-4.0.1/deps/jemalloc/include/jemalloc/jemalloc_rename.sh redis-4.0.1/deps/jemalloc/include/jemalloc/jemalloc_typedefs.h.in redis-4.0.1/deps/jemalloc/include/msvc_compat/ redis-4.0.1/deps/jemalloc/include/msvc_compat/C99/ redis-4.0.1/deps/jemalloc/include/msvc_compat/C99/stdbool.h redis-4.0.1/deps/jemalloc/include/msvc_compat/C99/stdint.h redis-4.0.1/deps/jemalloc/include/msvc_compat/strings.h redis-4.0.1/deps/jemalloc/include/msvc_compat/windows_extra.h redis-4.0.1/deps/jemalloc/install-sh redis-4.0.1/deps/jemalloc/jemalloc.pc.in redis-4.0.1/deps/jemalloc/src/ redis-4.0.1/deps/jemalloc/src/arena.c redis-4.0.1/deps/jemalloc/src/atomic.c redis-4.0.1/deps/jemalloc/src/base.c redis-4.0.1/deps/jemalloc/src/bitmap.c redis-4.0.1/deps/jemalloc/src/chunk.c redis-4.0.1/deps/jemalloc/src/chunk_dss.c redis-4.0.1/deps/jemalloc/src/chunk_mmap.c redis-4.0.1/deps/jemalloc/src/ckh.c redis-4.0.1/deps/jemalloc/src/ctl.c redis-4.0.1/deps/jemalloc/src/extent.c redis-4.0.1/deps/jemalloc/src/hash.c redis-4.0.1/deps/jemalloc/src/huge.c redis-4.0.1/deps/jemalloc/src/jemalloc.c redis-4.0.1/deps/jemalloc/src/mb.c redis-4.0.1/deps/jemalloc/src/mutex.c redis-4.0.1/deps/jemalloc/src/pages.c redis-4.0.1/deps/jemalloc/src/prof.c redis-4.0.1/deps/jemalloc/src/quarantine.c redis-4.0.1/deps/jemalloc/src/rtree.c redis-4.0.1/deps/jemalloc/src/stats.c redis-4.0.1/deps/jemalloc/src/tcache.c redis-4.0.1/deps/jemalloc/src/tsd.c redis-4.0.1/deps/jemalloc/src/util.c redis-4.0.1/deps/jemalloc/src/valgrind.c redis-4.0.1/deps/jemalloc/src/zone.c redis-4.0.1/deps/jemalloc/test/ redis-4.0.1/deps/jemalloc/test/include/ redis-4.0.1/deps/jemalloc/test/include/test/ redis-4.0.1/deps/jemalloc/test/include/test/SFMT-alti.h redis-4.0.1/deps/jemalloc/test/include/test/SFMT-params.h redis-4.0.1/deps/jemalloc/test/include/test/SFMT-params11213.h redis-4.0.1/deps/jemalloc/test/include/test/SFMT-params1279.h redis-4.0.1/deps/jemalloc/test/include/test/SFMT-params132049.h redis-4.0.1/deps/jemalloc/test/include/test/SFMT-params19937.h redis-4.0.1/deps/jemalloc/test/include/test/SFMT-params216091.h redis-4.0.1/deps/jemalloc/test/include/test/SFMT-params2281.h redis-4.0.1/deps/jemalloc/test/include/test/SFMT-params4253.h redis-4.0.1/deps/jemalloc/test/include/test/SFMT-params44497.h redis-4.0.1/deps/jemalloc/test/include/test/SFMT-params607.h redis-4.0.1/deps/jemalloc/test/include/test/SFMT-params86243.h redis-4.0.1/deps/jemalloc/test/include/test/SFMT-sse2.h redis-4.0.1/deps/jemalloc/test/include/test/SFMT.h redis-4.0.1/deps/jemalloc/test/include/test/btalloc.h redis-4.0.1/deps/jemalloc/test/include/test/jemalloc_test.h.in redis-4.0.1/deps/jemalloc/test/include/test/jemalloc_test_defs.h.in redis-4.0.1/deps/jemalloc/test/include/test/math.h redis-4.0.1/deps/jemalloc/test/include/test/mq.h redis-4.0.1/deps/jemalloc/test/include/test/mtx.h redis-4.0.1/deps/jemalloc/test/include/test/test.h redis-4.0.1/deps/jemalloc/test/include/test/thd.h redis-4.0.1/deps/jemalloc/test/include/test/timer.h redis-4.0.1/deps/jemalloc/test/integration/ redis-4.0.1/deps/jemalloc/test/integration/MALLOCX_ARENA.c redis-4.0.1/deps/jemalloc/test/integration/aligned_alloc.c redis-4.0.1/deps/jemalloc/test/integration/allocated.c redis-4.0.1/deps/jemalloc/test/integration/chunk.c redis-4.0.1/deps/jemalloc/test/integration/mallocx.c redis-4.0.1/deps/jemalloc/test/integration/overflow.c redis-4.0.1/deps/jemalloc/test/integration/posix_memalign.c redis-4.0.1/deps/jemalloc/test/integration/rallocx.c redis-4.0.1/deps/jemalloc/test/integration/sdallocx.c redis-4.0.1/deps/jemalloc/test/integration/thread_arena.c redis-4.0.1/deps/jemalloc/test/integration/thread_tcache_enabled.c redis-4.0.1/deps/jemalloc/test/integration/xallocx.c redis-4.0.1/deps/jemalloc/test/src/ redis-4.0.1/deps/jemalloc/test/src/SFMT.c redis-4.0.1/deps/jemalloc/test/src/btalloc.c redis-4.0.1/deps/jemalloc/test/src/btalloc_0.c redis-4.0.1/deps/jemalloc/test/src/btalloc_1.c redis-4.0.1/deps/jemalloc/test/src/math.c redis-4.0.1/deps/jemalloc/test/src/mq.c redis-4.0.1/deps/jemalloc/test/src/mtx.c redis-4.0.1/deps/jemalloc/test/src/test.c redis-4.0.1/deps/jemalloc/test/src/thd.c redis-4.0.1/deps/jemalloc/test/src/timer.c redis-4.0.1/deps/jemalloc/test/stress/ redis-4.0.1/deps/jemalloc/test/stress/microbench.c redis-4.0.1/deps/jemalloc/test/test.sh.in redis-4.0.1/deps/jemalloc/test/unit/ redis-4.0.1/deps/jemalloc/test/unit/SFMT.c redis-4.0.1/deps/jemalloc/test/unit/atomic.c redis-4.0.1/deps/jemalloc/test/unit/bitmap.c redis-4.0.1/deps/jemalloc/test/unit/ckh.c redis-4.0.1/deps/jemalloc/test/unit/hash.c redis-4.0.1/deps/jemalloc/test/unit/junk.c redis-4.0.1/deps/jemalloc/test/unit/junk_alloc.c redis-4.0.1/deps/jemalloc/test/unit/junk_free.c redis-4.0.1/deps/jemalloc/test/unit/lg_chunk.c redis-4.0.1/deps/jemalloc/test/unit/mallctl.c redis-4.0.1/deps/jemalloc/test/unit/math.c redis-4.0.1/deps/jemalloc/test/unit/mq.c redis-4.0.1/deps/jemalloc/test/unit/mtx.c redis-4.0.1/deps/jemalloc/test/unit/prof_accum.c redis-4.0.1/deps/jemalloc/test/unit/prof_active.c redis-4.0.1/deps/jemalloc/test/unit/prof_gdump.c redis-4.0.1/deps/jemalloc/test/unit/prof_idump.c redis-4.0.1/deps/jemalloc/test/unit/prof_reset.c redis-4.0.1/deps/jemalloc/test/unit/prof_thread_name.c redis-4.0.1/deps/jemalloc/test/unit/ql.c redis-4.0.1/deps/jemalloc/test/unit/qr.c redis-4.0.1/deps/jemalloc/test/unit/quarantine.c redis-4.0.1/deps/jemalloc/test/unit/rb.c redis-4.0.1/deps/jemalloc/test/unit/rtree.c redis-4.0.1/deps/jemalloc/test/unit/size_classes.c redis-4.0.1/deps/jemalloc/test/unit/stats.c redis-4.0.1/deps/jemalloc/test/unit/tsd.c redis-4.0.1/deps/jemalloc/test/unit/util.c redis-4.0.1/deps/jemalloc/test/unit/zero.c redis-4.0.1/deps/linenoise/ redis-4.0.1/deps/linenoise/.gitignore redis-4.0.1/deps/linenoise/Makefile redis-4.0.1/deps/linenoise/README.markdown redis-4.0.1/deps/linenoise/example.c redis-4.0.1/deps/linenoise/linenoise.c redis-4.0.1/deps/linenoise/linenoise.h redis-4.0.1/deps/lua/ redis-4.0.1/deps/lua/COPYRIGHT redis-4.0.1/deps/lua/HISTORY redis-4.0.1/deps/lua/INSTALL redis-4.0.1/deps/lua/Makefile redis-4.0.1/deps/lua/README redis-4.0.1/deps/lua/doc/ redis-4.0.1/deps/lua/doc/contents.html redis-4.0.1/deps/lua/doc/cover.png redis-4.0.1/deps/lua/doc/logo.gif redis-4.0.1/deps/lua/doc/lua.1 redis-4.0.1/deps/lua/doc/lua.css redis-4.0.1/deps/lua/doc/lua.html redis-4.0.1/deps/lua/doc/luac.1 redis-4.0.1/deps/lua/doc/luac.html redis-4.0.1/deps/lua/doc/manual.css redis-4.0.1/deps/lua/doc/manual.html redis-4.0.1/deps/lua/doc/readme.html redis-4.0.1/deps/lua/etc/ redis-4.0.1/deps/lua/etc/Makefile redis-4.0.1/deps/lua/etc/README redis-4.0.1/deps/lua/etc/all.c redis-4.0.1/deps/lua/etc/lua.hpp redis-4.0.1/deps/lua/etc/lua.ico redis-4.0.1/deps/lua/etc/lua.pc redis-4.0.1/deps/lua/etc/luavs.bat redis-4.0.1/deps/lua/etc/min.c redis-4.0.1/deps/lua/etc/noparser.c redis-4.0.1/deps/lua/etc/strict.lua redis-4.0.1/deps/lua/src/ redis-4.0.1/deps/lua/src/Makefile redis-4.0.1/deps/lua/src/fpconv.c redis-4.0.1/deps/lua/src/fpconv.h redis-4.0.1/deps/lua/src/lapi.c redis-4.0.1/deps/lua/src/lapi.h redis-4.0.1/deps/lua/src/lauxlib.c redis-4.0.1/deps/lua/src/lauxlib.h redis-4.0.1/deps/lua/src/lbaselib.c redis-4.0.1/deps/lua/src/lcode.c redis-4.0.1/deps/lua/src/lcode.h redis-4.0.1/deps/lua/src/ldblib.c redis-4.0.1/deps/lua/src/ldebug.c redis-4.0.1/deps/lua/src/ldebug.h redis-4.0.1/deps/lua/src/ldo.c redis-4.0.1/deps/lua/src/ldo.h redis-4.0.1/deps/lua/src/ldump.c redis-4.0.1/deps/lua/src/lfunc.c redis-4.0.1/deps/lua/src/lfunc.h redis-4.0.1/deps/lua/src/lgc.c redis-4.0.1/deps/lua/src/lgc.h redis-4.0.1/deps/lua/src/linit.c redis-4.0.1/deps/lua/src/liolib.c redis-4.0.1/deps/lua/src/llex.c redis-4.0.1/deps/lua/src/llex.h redis-4.0.1/deps/lua/src/llimits.h redis-4.0.1/deps/lua/src/lmathlib.c redis-4.0.1/deps/lua/src/lmem.c redis-4.0.1/deps/lua/src/lmem.h redis-4.0.1/deps/lua/src/loadlib.c redis-4.0.1/deps/lua/src/lobject.c redis-4.0.1/deps/lua/src/lobject.h redis-4.0.1/deps/lua/src/lopcodes.c redis-4.0.1/deps/lua/src/lopcodes.h redis-4.0.1/deps/lua/src/loslib.c redis-4.0.1/deps/lua/src/lparser.c redis-4.0.1/deps/lua/src/lparser.h redis-4.0.1/deps/lua/src/lstate.c redis-4.0.1/deps/lua/src/lstate.h redis-4.0.1/deps/lua/src/lstring.c redis-4.0.1/deps/lua/src/lstring.h redis-4.0.1/deps/lua/src/lstrlib.c redis-4.0.1/deps/lua/src/ltable.c redis-4.0.1/deps/lua/src/ltable.h redis-4.0.1/deps/lua/src/ltablib.c redis-4.0.1/deps/lua/src/ltm.c redis-4.0.1/deps/lua/src/ltm.h redis-4.0.1/deps/lua/src/lua.c redis-4.0.1/deps/lua/src/lua.h redis-4.0.1/deps/lua/src/lua_bit.c redis-4.0.1/deps/lua/src/lua_cjson.c redis-4.0.1/deps/lua/src/lua_cmsgpack.c redis-4.0.1/deps/lua/src/lua_struct.c redis-4.0.1/deps/lua/src/luac.c redis-4.0.1/deps/lua/src/luaconf.h redis-4.0.1/deps/lua/src/lualib.h redis-4.0.1/deps/lua/src/lundump.c redis-4.0.1/deps/lua/src/lundump.h redis-4.0.1/deps/lua/src/lvm.c redis-4.0.1/deps/lua/src/lvm.h redis-4.0.1/deps/lua/src/lzio.c redis-4.0.1/deps/lua/src/lzio.h redis-4.0.1/deps/lua/src/print.c redis-4.0.1/deps/lua/src/strbuf.c redis-4.0.1/deps/lua/src/strbuf.h redis-4.0.1/deps/lua/test/ redis-4.0.1/deps/lua/test/README redis-4.0.1/deps/lua/test/bisect.lua redis-4.0.1/deps/lua/test/cf.lua redis-4.0.1/deps/lua/test/echo.lua redis-4.0.1/deps/lua/test/env.lua redis-4.0.1/deps/lua/test/factorial.lua redis-4.0.1/deps/lua/test/fib.lua redis-4.0.1/deps/lua/test/fibfor.lua redis-4.0.1/deps/lua/test/globals.lua redis-4.0.1/deps/lua/test/hello.lua redis-4.0.1/deps/lua/test/life.lua redis-4.0.1/deps/lua/test/luac.lua redis-4.0.1/deps/lua/test/printf.lua redis-4.0.1/deps/lua/test/readonly.lua redis-4.0.1/deps/lua/test/sieve.lua redis-4.0.1/deps/lua/test/sort.lua redis-4.0.1/deps/lua/test/table.lua redis-4.0.1/deps/lua/test/trace-calls.lua redis-4.0.1/deps/lua/test/trace-globals.lua redis-4.0.1/deps/lua/test/xd.lua redis-4.0.1/deps/update-jemalloc.sh redis-4.0.1/redis.conf redis-4.0.1/runtest redis-4.0.1/runtest-cluster redis-4.0.1/runtest-sentinel redis-4.0.1/sentinel.conf redis-4.0.1/src/ redis-4.0.1/src/.gitignore redis-4.0.1/src/Makefile redis-4.0.1/src/adlist.c redis-4.0.1/src/adlist.h redis-4.0.1/src/ae.c redis-4.0.1/src/ae.h redis-4.0.1/src/ae_epoll.c redis-4.0.1/src/ae_evport.c redis-4.0.1/src/ae_kqueue.c redis-4.0.1/src/ae_select.c redis-4.0.1/src/anet.c redis-4.0.1/src/anet.h redis-4.0.1/src/aof.c redis-4.0.1/src/asciilogo.h redis-4.0.1/src/atomicvar.h redis-4.0.1/src/bio.c redis-4.0.1/src/bio.h redis-4.0.1/src/bitops.c redis-4.0.1/src/blocked.c redis-4.0.1/src/childinfo.c redis-4.0.1/src/cluster.c redis-4.0.1/src/cluster.h redis-4.0.1/src/config.c redis-4.0.1/src/config.h redis-4.0.1/src/crc16.c redis-4.0.1/src/crc64.c redis-4.0.1/src/crc64.h redis-4.0.1/src/db.c redis-4.0.1/src/debug.c redis-4.0.1/src/debugmacro.h redis-4.0.1/src/defrag.c redis-4.0.1/src/dict.c redis-4.0.1/src/dict.h redis-4.0.1/src/endianconv.c redis-4.0.1/src/endianconv.h redis-4.0.1/src/evict.c redis-4.0.1/src/expire.c redis-4.0.1/src/fmacros.h redis-4.0.1/src/geo.c redis-4.0.1/src/geo.h redis-4.0.1/src/geohash.c redis-4.0.1/src/geohash.h redis-4.0.1/src/geohash_helper.c redis-4.0.1/src/geohash_helper.h redis-4.0.1/src/help.h redis-4.0.1/src/hyperloglog.c redis-4.0.1/src/intset.c redis-4.0.1/src/intset.h redis-4.0.1/src/latency.c redis-4.0.1/src/latency.h redis-4.0.1/src/lazyfree.c redis-4.0.1/src/lzf.h redis-4.0.1/src/lzfP.h redis-4.0.1/src/lzf_c.c redis-4.0.1/src/lzf_d.c redis-4.0.1/src/memtest.c redis-4.0.1/src/mkreleasehdr.sh redis-4.0.1/src/module.c redis-4.0.1/src/modules/ redis-4.0.1/src/modules/.gitignore redis-4.0.1/src/modules/Makefile redis-4.0.1/src/modules/gendoc.rb redis-4.0.1/src/modules/helloblock.c redis-4.0.1/src/modules/hellotype.c redis-4.0.1/src/modules/helloworld.c redis-4.0.1/src/modules/testmodule.c redis-4.0.1/src/multi.c redis-4.0.1/src/networking.c redis-4.0.1/src/notify.c redis-4.0.1/src/object.c redis-4.0.1/src/pqsort.c redis-4.0.1/src/pqsort.h redis-4.0.1/src/pubsub.c redis-4.0.1/src/quicklist.c redis-4.0.1/src/quicklist.h redis-4.0.1/src/rand.c redis-4.0.1/src/rand.h redis-4.0.1/src/rax.c redis-4.0.1/src/rax.h redis-4.0.1/src/rax_malloc.h redis-4.0.1/src/rdb.c redis-4.0.1/src/rdb.h redis-4.0.1/src/redis-benchmark.c redis-4.0.1/src/redis-check-aof.c redis-4.0.1/src/redis-check-rdb.c redis-4.0.1/src/redis-cli.c redis-4.0.1/src/redis-trib.rb redis-4.0.1/src/redisassert.h redis-4.0.1/src/redismodule.h redis-4.0.1/src/release.c redis-4.0.1/src/replication.c redis-4.0.1/src/rio.c redis-4.0.1/src/rio.h redis-4.0.1/src/scripting.c redis-4.0.1/src/sds.c redis-4.0.1/src/sds.h redis-4.0.1/src/sdsalloc.h redis-4.0.1/src/sentinel.c redis-4.0.1/src/server.c redis-4.0.1/src/server.h redis-4.0.1/src/setproctitle.c redis-4.0.1/src/sha1.c redis-4.0.1/src/sha1.h redis-4.0.1/src/siphash.c redis-4.0.1/src/slowlog.c redis-4.0.1/src/slowlog.h redis-4.0.1/src/solarisfixes.h redis-4.0.1/src/sort.c redis-4.0.1/src/sparkline.c redis-4.0.1/src/sparkline.h redis-4.0.1/src/syncio.c redis-4.0.1/src/t_hash.c redis-4.0.1/src/t_list.c redis-4.0.1/src/t_set.c redis-4.0.1/src/t_string.c redis-4.0.1/src/t_zset.c redis-4.0.1/src/testhelp.h redis-4.0.1/src/util.c redis-4.0.1/src/util.h redis-4.0.1/src/valgrind.sup redis-4.0.1/src/version.h redis-4.0.1/src/ziplist.c redis-4.0.1/src/ziplist.h redis-4.0.1/src/zipmap.c redis-4.0.1/src/zipmap.h redis-4.0.1/src/zmalloc.c redis-4.0.1/src/zmalloc.h redis-4.0.1/tests/ redis-4.0.1/tests/assets/ redis-4.0.1/tests/assets/default.conf redis-4.0.1/tests/assets/encodings.rdb redis-4.0.1/tests/assets/hash-zipmap.rdb redis-4.0.1/tests/cluster/ redis-4.0.1/tests/cluster/cluster.tcl redis-4.0.1/tests/cluster/run.tcl redis-4.0.1/tests/cluster/tests/ redis-4.0.1/tests/cluster/tests/00-base.tcl redis-4.0.1/tests/cluster/tests/01-faildet.tcl redis-4.0.1/tests/cluster/tests/02-failover.tcl redis-4.0.1/tests/cluster/tests/03-failover-loop.tcl redis-4.0.1/tests/cluster/tests/04-resharding.tcl redis-4.0.1/tests/cluster/tests/05-slave-selection.tcl redis-4.0.1/tests/cluster/tests/06-slave-stop-cond.tcl redis-4.0.1/tests/cluster/tests/07-replica-migration.tcl redis-4.0.1/tests/cluster/tests/08-update-msg.tcl redis-4.0.1/tests/cluster/tests/09-pubsub.tcl redis-4.0.1/tests/cluster/tests/10-manual-failover.tcl redis-4.0.1/tests/cluster/tests/11-manual-takeover.tcl redis-4.0.1/tests/cluster/tests/12-replica-migration-2.tcl redis-4.0.1/tests/cluster/tests/helpers/ redis-4.0.1/tests/cluster/tests/helpers/onlydots.tcl redis-4.0.1/tests/cluster/tests/includes/ redis-4.0.1/tests/cluster/tests/includes/init-tests.tcl redis-4.0.1/tests/cluster/tmp/ redis-4.0.1/tests/cluster/tmp/.gitignore redis-4.0.1/tests/helpers/ redis-4.0.1/tests/helpers/bg_complex_data.tcl redis-4.0.1/tests/helpers/gen_write_load.tcl redis-4.0.1/tests/instances.tcl redis-4.0.1/tests/integration/ redis-4.0.1/tests/integration/aof-race.tcl redis-4.0.1/tests/integration/aof.tcl redis-4.0.1/tests/integration/convert-zipmap-hash-on-load.tcl redis-4.0.1/tests/integration/logging.tcl redis-4.0.1/tests/integration/psync2-reg.tcl redis-4.0.1/tests/integration/psync2.tcl redis-4.0.1/tests/integration/rdb.tcl redis-4.0.1/tests/integration/redis-cli.tcl redis-4.0.1/tests/integration/replication-2.tcl redis-4.0.1/tests/integration/replication-3.tcl redis-4.0.1/tests/integration/replication-4.tcl redis-4.0.1/tests/integration/replication-psync.tcl redis-4.0.1/tests/integration/replication.tcl redis-4.0.1/tests/sentinel/ redis-4.0.1/tests/sentinel/run.tcl redis-4.0.1/tests/sentinel/tests/ redis-4.0.1/tests/sentinel/tests/00-base.tcl redis-4.0.1/tests/sentinel/tests/01-conf-update.tcl redis-4.0.1/tests/sentinel/tests/02-slaves-reconf.tcl redis-4.0.1/tests/sentinel/tests/03-runtime-reconf.tcl redis-4.0.1/tests/sentinel/tests/04-slave-selection.tcl redis-4.0.1/tests/sentinel/tests/05-manual.tcl redis-4.0.1/tests/sentinel/tests/06-ckquorum.tcl redis-4.0.1/tests/sentinel/tests/07-down-conditions.tcl redis-4.0.1/tests/sentinel/tests/includes/ redis-4.0.1/tests/sentinel/tests/includes/init-tests.tcl redis-4.0.1/tests/sentinel/tmp/ redis-4.0.1/tests/sentinel/tmp/.gitignore redis-4.0.1/tests/support/ redis-4.0.1/tests/support/cluster.tcl redis-4.0.1/tests/support/redis.tcl redis-4.0.1/tests/support/server.tcl redis-4.0.1/tests/support/test.tcl redis-4.0.1/tests/support/tmpfile.tcl redis-4.0.1/tests/support/util.tcl redis-4.0.1/tests/test_helper.tcl redis-4.0.1/tests/tmp/ redis-4.0.1/tests/tmp/.gitignore redis-4.0.1/tests/unit/ redis-4.0.1/tests/unit/aofrw.tcl redis-4.0.1/tests/unit/auth.tcl redis-4.0.1/tests/unit/bitfield.tcl redis-4.0.1/tests/unit/bitops.tcl redis-4.0.1/tests/unit/dump.tcl redis-4.0.1/tests/unit/expire.tcl redis-4.0.1/tests/unit/geo.tcl redis-4.0.1/tests/unit/hyperloglog.tcl redis-4.0.1/tests/unit/introspection-2.tcl redis-4.0.1/tests/unit/introspection.tcl redis-4.0.1/tests/unit/keyspace.tcl redis-4.0.1/tests/unit/latency-monitor.tcl redis-4.0.1/tests/unit/lazyfree.tcl redis-4.0.1/tests/unit/limits.tcl redis-4.0.1/tests/unit/maxmemory.tcl redis-4.0.1/tests/unit/memefficiency.tcl redis-4.0.1/tests/unit/multi.tcl redis-4.0.1/tests/unit/obuf-limits.tcl redis-4.0.1/tests/unit/other.tcl redis-4.0.1/tests/unit/printver.tcl redis-4.0.1/tests/unit/protocol.tcl redis-4.0.1/tests/unit/pubsub.tcl redis-4.0.1/tests/unit/quit.tcl redis-4.0.1/tests/unit/scan.tcl redis-4.0.1/tests/unit/scripting.tcl redis-4.0.1/tests/unit/slowlog.tcl redis-4.0.1/tests/unit/sort.tcl redis-4.0.1/tests/unit/type/ redis-4.0.1/tests/unit/type/hash.tcl redis-4.0.1/tests/unit/type/incr.tcl redis-4.0.1/tests/unit/type/list-2.tcl redis-4.0.1/tests/unit/type/list-3.tcl redis-4.0.1/tests/unit/type/list-common.tcl redis-4.0.1/tests/unit/type/list.tcl redis-4.0.1/tests/unit/type/set.tcl redis-4.0.1/tests/unit/type/string.tcl redis-4.0.1/tests/unit/type/zset.tcl redis-4.0.1/tests/unit/wait.tcl redis-4.0.1/utils/ redis-4.0.1/utils/build-static-symbols.tcl redis-4.0.1/utils/cluster_fail_time.tcl redis-4.0.1/utils/corrupt_rdb.c redis-4.0.1/utils/create-cluster/ redis-4.0.1/utils/create-cluster/.gitignore redis-4.0.1/utils/create-cluster/README redis-4.0.1/utils/create-cluster/create-cluster redis-4.0.1/utils/generate-command-help.rb redis-4.0.1/utils/graphs/ redis-4.0.1/utils/graphs/commits-over-time/ redis-4.0.1/utils/graphs/commits-over-time/README.md redis-4.0.1/utils/graphs/commits-over-time/genhtml.tcl redis-4.0.1/utils/hashtable/ redis-4.0.1/utils/hashtable/README redis-4.0.1/utils/hashtable/rehashing.c redis-4.0.1/utils/hyperloglog/ redis-4.0.1/utils/hyperloglog/.gitignore redis-4.0.1/utils/hyperloglog/hll-err.rb redis-4.0.1/utils/hyperloglog/hll-gnuplot-graph.rb redis-4.0.1/utils/install_server.sh redis-4.0.1/utils/lru/ redis-4.0.1/utils/lru/README redis-4.0.1/utils/lru/lfu-simulation.c redis-4.0.1/utils/lru/test-lru.rb redis-4.0.1/utils/redis-copy.rb redis-4.0.1/utils/redis-sha1.rb redis-4.0.1/utils/redis_init_script redis-4.0.1/utils/redis_init_script.tpl redis-4.0.1/utils/releasetools/ redis-4.0.1/utils/releasetools/01_create_tarball.sh redis-4.0.1/utils/releasetools/02_upload_tarball.sh redis-4.0.1/utils/releasetools/03_test_release.sh redis-4.0.1/utils/releasetools/04_release_hash.sh redis-4.0.1/utils/releasetools/changelog.tcl redis-4.0.1/utils/speed-regression.tcl redis-4.0.1/utils/whatisdoing.sh [root@localhost data]# ll 总用量 1676 drwxrwxr-x. 6 root root 4096 7月 24 22:58 redis-4.0.1 -rw-r--r--. 1 root root 1711660 7月 24 22:59 redis-4.0.1.tar.gz [root@localhost data]#
③移动到/local/usr/redis目录下去,这个纯属个人爱好
[root@localhost data]# ll 总用量 1676 drwxrwxr-x. 6 root root 4096 7月 24 22:58 redis-4.0.1 -rw-r--r--. 1 root root 1711660 7月 24 22:59 redis-4.0.1.tar.gz [root@localhost data]# mv redis-4.0.1 ../redis [root@localhost data]# cd .. [root@localhost local]# ll 总用量 44 drwxr-xr-x. 2 root root 4096 9月 3 09:43 bin drwxr-xr-x. 2 root root 4096 9月 3 10:04 data drwxr-xr-x. 2 root root 4096 9月 23 2011 etc drwxr-xr-x. 2 root root 4096 9月 23 2011 games drwxr-xr-x. 2 root root 4096 9月 23 2011 include drwxr-xr-x. 2 root root 4096 9月 23 2011 lib drwxr-xr-x. 2 root root 4096 9月 23 2011 libexec drwxrwxr-x. 6 root root 4096 7月 24 22:58 redis drwxr-xr-x. 2 root root 4096 9月 23 2011 sbin drwxr-xr-x. 5 root root 4096 4月 1 04:48 share drwxr-xr-x. 2 root root 4096 9月 23 2011 src [root@localhost local]# cd redis [root@localhost redis]# ll 总用量 276 -rw-rw-r--. 1 root root 127778 7月 24 22:58 00-RELEASENOTES -rw-rw-r--. 1 root root 53 7月 24 22:58 BUGS -rw-rw-r--. 1 root root 1815 7月 24 22:58 CONTRIBUTING -rw-rw-r--. 1 root root 1487 7月 24 22:58 COPYING drwxrwxr-x. 6 root root 4096 7月 24 22:58 deps -rw-rw-r--. 1 root root 11 7月 24 22:58 INSTALL -rw-rw-r--. 1 root root 151 7月 24 22:58 Makefile -rw-rw-r--. 1 root root 4223 7月 24 22:58 MANIFESTO -rw-rw-r--. 1 root root 20530 7月 24 22:58 README.md -rw-rw-r--. 1 root root 57764 7月 24 22:58 redis.conf -rwxrwxr-x. 1 root root 271 7月 24 22:58 runtest -rwxrwxr-x. 1 root root 280 7月 24 22:58 runtest-cluster -rwxrwxr-x. 1 root root 281 7月 24 22:58 runtest-sentinel -rw-rw-r--. 1 root root 7606 7月 24 22:58 sentinel.conf drwxrwxr-x. 3 root root 4096 7月 24 22:58 src drwxrwxr-x. 10 root root 4096 7月 24 22:58 tests drwxrwxr-x. 8 root root 4096 7月 24 22:58 utils [root@localhost redis]# cd .. [root@localhost local]#
④接下来就是编译了,通过make命令,如果编译的时候报gcc命令找不到的话,可以通过下面的命令安装gcc命令,gcc是c的编译命令
yum install gcc-c++
下面就通过make来编译,make是自动编译,会根据Makefile中描述的内容来进行编译。
[root@localhost redis]# make cd src && make all make[1]: Entering directory `/usr/local/redis/src' CC Makefile.dep . . . . Hint: It's a good idea to run 'make test' ;) make[1]: Leaving directory `/usr/local/redis/src' [root@localhost redis]#
⑤可以看到在src目录下生成了几个新的文件。
[root@localhost redis]# ll -tr src 总用量 44440 -rw-rw-r--. 1 root root 3779 7月 24 22:58 zmalloc.h . . . -rw-r--r--. 1 root root 56148 9月 3 10:11 rax.o -rwxr-xr-x. 1 root root 7185836 9月 3 10:11 redis-server -rwxr-xr-x. 1 root root 7185836 9月 3 10:11 redis-sentinel -rw-r--r--. 1 root root 143800 9月 3 10:11 redis-cli.o -rwxr-xr-x. 1 root root 5092431 9月 3 10:11 redis-cli -rw-r--r--. 1 root root 44892 9月 3 10:11 redis-benchmark.o -rwxr-xr-x. 1 root root 4985275 9月 3 10:11 redis-benchmark -rwxr-xr-x. 1 root root 7185836 9月 3 10:11 redis-check-rdb -rwxr-xr-x. 1 root root 7185836 9月 3 10:11 redis-check-aof [root@localhost redis]#
为了使用方便,我们需要将这个几个文件加到/usr/local/bin目录下去。这个目录在Path下面的话,就可以直接执行这几个命令了。
[root@localhost redis]# make install cd src && make install make[1]: Entering directory `/usr/local/redis/src' CC Makefile.dep make[1]: Leaving directory `/usr/local/redis/src' make[1]: Entering directory `/usr/local/redis/src' Hint: It's a good idea to run 'make test' ;) INSTALL install INSTALL install INSTALL install INSTALL install INSTALL install make[1]: Leaving directory `/usr/local/redis/src' [root@localhost redis]# cd .. [root@localhost local]# ll 总用量 44 drwxr-xr-x. 2 root root 4096 9月 3 10:16 bin drwxr-xr-x. 2 root root 4096 9月 3 10:04 data drwxr-xr-x. 2 root root 4096 9月 23 2011 etc drwxr-xr-x. 2 root root 4096 9月 23 2011 games drwxr-xr-x. 2 root root 4096 9月 23 2011 include drwxr-xr-x. 2 root root 4096 9月 23 2011 lib drwxr-xr-x. 2 root root 4096 9月 23 2011 libexec drwxrwxr-x. 6 root root 4096 7月 24 22:58 redis drwxr-xr-x. 2 root root 4096 9月 23 2011 sbin drwxr-xr-x. 5 root root 4096 4月 1 04:48 share drwxr-xr-x. 2 root root 4096 9月 23 2011 src [root@localhost local]# ll bin 总用量 30908 -rwxr-xr-x. 1 root root 4985275 9月 3 10:16 redis-benchmark -rwxr-xr-x. 1 root root 7185836 9月 3 10:16 redis-check-aof -rwxr-xr-x. 1 root root 7185836 9月 3 10:16 redis-check-rdb -rwxr-xr-x. 1 root root 5092431 9月 3 10:16 redis-cli lrwxrwxrwx. 1 root root 12 9月 3 10:16 redis-sentinel -> redis-server -rwxr-xr-x. 1 root root 7185836 9月 3 10:16 redis-server [root@localhost local]#
可以看到,这几个文件就已经被加载到bin目录下了
⑥下面启动服务器,来看看安装是否成功。使用redis-server命令。
[root@localhost local]# redis-server 9190:C 03 Sep 10:19:09.291 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 9190:C 03 Sep 10:19:09.292 # Redis version=4.0.1, bits=32, commit=00000000, modified=0, pid=9190, just started 9190:C 03 Sep 10:19:09.292 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 9190:M 03 Sep 10:19:09.295 * Increased maximum number of open files to 10032 (it was originally set to 1024). 9190:M 03 Sep 10:19:09.312 # Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now. _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 4.0.1 (00000000/0) 32 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 9190 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 9190:M 03 Sep 10:19:09.316 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 9190:M 03 Sep 10:19:09.316 # Server initialized 9190:M 03 Sep 10:19:09.318 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. 9190:M 03 Sep 10:19:09.318 * Ready to accept connections
看到这个界面的话,就表示安装成功了。
下面通过在启动一个linux客户端,通过server-cli shutdown来关闭服务器。
[root@localhost ~]# redis-cli shutdown [root@localhost ~]# 下面是刚刚服务器启动的客户端的log 9190:M 03 Sep 10:20:45.566 # User requested shutdown... 9190:M 03 Sep 10:20:45.566 * Saving the final RDB snapshot before exiting. 9190:M 03 Sep 10:20:45.631 * DB saved on disk 9190:M 03 Sep 10:20:45.631 # Redis is now ready to exit, bye bye... [root@localhost local]#
可以看到,前面在启动redis服务器后,都是在前台启动的,需要重新启动一个客户端来进行登陆操作。这样非常不方便,
所以,我们需要设置后台启动。
在redis.conf的配置文件里面。做如下的修改:
daemonize no
修改为:
daemonize yes
下面需要设置redis服务器开机自动启动:
要先让redis服务自动启动的话,首先需要在/etc/init.d目录下创建redis的启动脚本。
将redis安装目录下的utils/redis_init_script复制到/etc/init.d目录下,命名为redis(名字简单,使用方便)
[root@localhost utils]# cp redis_init_script /etc/init.d/redis [root@localhost utils]# ll /etc/init.d/redis -rwxr-xr-x. 1 root root 1098 9月 3 13:02 /etc/init.d/redis [root@localhost utils]#
继续编辑启动文件,修改其中指定的pid和配置文件。
PIDFILE=/var/run/redis_${REDISPORT}.pid CONF="/etc/redis/${REDISPORT}.conf" 修改为 PIDFILE=/var/redis/run/redis_${REDISPORT}.pid CONF="/etc/redis/redis.conf"
首先创建存放pid的目录为/var/redis/run
[root@localhost var]# pwd /var [root@localhost var]# mkdir redis [root@localhost var]# cd redis [root@localhost redis]# mkdir run [root@localhost redis]#
接下来,我们需要把配置文件复制一份到/etc/redis这个目录下面去
[root@localhost etc]# mkdir redis [root@localhost etc]# cd redis [root@localhost redis]# ll 总用量 0 [root@localhost redis]# cp /usr/local/redis/redis.conf ./ [root@localhost redis]# ll 总用量 60 -rw-r--r--. 1 root root 57765 9月 3 13:12 redis.conf [root@localhost redis]# pwd /etc/redis [root@localhost redis]#
修改配置文件中的pid为前面配置的pid。
pidfile /var/run/redis_6379.pid
修改为
pidfile /var/redis/run/redis_6379.pid
至此为止,我们已经可以通过service redis start/stop来启动和关闭redis服务了。
最后只需要通过chkconfig redis on命令来设置开机启动即可。
如果提示redis 服务不支持 chkconfig的话,只需要在/etc/init.d/redis这个启动脚本的第二行后面加上下面的内容即可。
# chkconfig:2345 90 10
#
# description:Redis is a persistent key-value database
[root@localhost ~]# chkconfig redis on redis 服务不支持 chkconfig [root@localhost ~]# vi /etc/init.d/redis [root@localhost ~]# chkconfig redis on [root@localhost ~]#
卸载redis非常的简单,只需要简单的三步
1、停止redis服务器
首先,通过下面的命令查看redis服务是否在运行
[root@localhost ~]# ps aux|grep redis root 2553 0.2 0.1 41964 1916 ? Ssl 09:38 0:00 redis-server 127.0.0.1:6379 root 2565 0.0 0.0 6048 780 pts/0 S+ 09:39 0:00 grep redis [root@localhost ~]#
可以看到,在6379端口,有redis-server的监听
通过下面的命令停止redis服务器。
[root@localhost ~]# redis-cli shutdown [root@localhost ~]# ps aux|grep redis
root 2575 0.0 0.0 6048 780 pts/0 S+ 09:41 0:00 grep redis [root@localhost ~]#
可以看到,已经停止了redis服务了。
需要注意的是,由于我的redis命令都安装到/usr/local/bin目录下面了,并且添加到环境变量PATH里面了,所以可以直接运行。
2、删除make的时候生成的几个redisXXX的文件
[root@localhost local]# ll /usr/local/bin 总用量 30908 -rwxr-xr-x. 1 root root 4985307 9月 2 21:13 redis-benchmark -rwxr-xr-x. 1 root root 7185872 9月 2 21:13 redis-check-aof -rwxr-xr-x. 1 root root 7185872 9月 2 21:13 redis-check-rdb -rwxr-xr-x. 1 root root 5092475 9月 2 21:13 redis-cli lrwxrwxrwx. 1 root root 12 9月 2 21:13 redis-sentinel -> redis-server -rwxr-xr-x. 1 root root 7185872 9月 2 21:13 redis-server [root@localhost local]# rm -f /usr/local/bin/redis* [root@localhost local]# ll /usr/local/bin 总用量 0 [root@localhost local]#
3、顺便也删除掉解压后的文件目录和所以文件
[root@localhost local]# ll 总用量 40 drwxr-xr-x. 2 root root 4096 9月 3 09:43 bin drwxr-xr-x. 2 root root 4096 9月 23 2011 etc drwxr-xr-x. 2 root root 4096 9月 23 2011 games drwxr-xr-x. 2 root root 4096 9月 23 2011 include drwxr-xr-x. 2 root root 4096 9月 23 2011 lib drwxr-xr-x. 2 root root 4096 9月 23 2011 libexec drwxrwxr-x. 6 root root 4096 9月 2 21:11 redis drwxr-xr-x. 2 root root 4096 9月 23 2011 sbin drwxr-xr-x. 5 root root 4096 4月 1 04:48 share drwxr-xr-x. 2 root root 4096 9月 23 2011 src [root@localhost local]# rm -rf redis [root@localhost local]# ll 总用量 36 drwxr-xr-x. 2 root root 4096 9月 3 09:43 bin drwxr-xr-x. 2 root root 4096 9月 23 2011 etc drwxr-xr-x. 2 root root 4096 9月 23 2011 games drwxr-xr-x. 2 root root 4096 9月 23 2011 include drwxr-xr-x. 2 root root 4096 9月 23 2011 lib drwxr-xr-x. 2 root root 4096 9月 23 2011 libexec drwxr-xr-x. 2 root root 4096 9月 23 2011 sbin drwxr-xr-x. 5 root root 4096 4月 1 04:48 share drwxr-xr-x. 2 root root 4096 9月 23 2011 src [root@localhost local]#
这样,redis就卸载完成了。