Redis Quick Start [遇到问题解决问题版]
http://redis.io/topics/quickstart
make test 时的问题:
问题:gcc: Command not found
解决:yum install gcc
[root@VM_7_88_centos redis-stable]# yum install gcc Loaded plugins: fastestmirror, langpacks epel | 4.3 kB 00:00:00 extras | 3.4 kB 00:00:00 os | 3.6 kB 00:00:00 updates | 3.4 kB 00:00:00 Determining fastest mirrors Resolving Dependencies --> Running transaction check ---> Package gcc.x86_64 0:4.8.5-4.el7 will be installed --> Processing Dependency: libgomp = 4.8.5-4.el7 for package: gcc-4.8.5-4.el7.x86_64 --> Processing Dependency: cpp = 4.8.5-4.el7 for package: gcc-4.8.5-4.el7.x86_64 --> Processing Dependency: libgcc >= 4.8.5-4.el7 for package: gcc-4.8.5-4.el7.x86_64 --> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-4.8.5-4.el7.x86_64 --> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-4.el7.x86_64 --> Running transaction check ---> Package cpp.x86_64 0:4.8.5-4.el7 will be installed ---> Package libgcc.i686 0:4.8.3-9.el7 will be updated ---> Package libgcc.x86_64 0:4.8.3-9.el7 will be updated ---> Package libgcc.i686 0:4.8.5-4.el7 will be an update ---> Package libgcc.x86_64 0:4.8.5-4.el7 will be an update ---> Package libgomp.x86_64 0:4.8.3-9.el7 will be updated ---> Package libgomp.x86_64 0:4.8.5-4.el7 will be an update ---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed ---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================== Installing: gcc x86_64 4.8.5-4.el7 os 16 M Installing for dependencies: cpp x86_64 4.8.5-4.el7 os 5.9 M libmpc x86_64 1.0.1-3.el7 os 51 k mpfr x86_64 3.1.1-4.el7 os 203 k Updating for dependencies: libgcc i686 4.8.5-4.el7 os 103 k libgcc x86_64 4.8.5-4.el7 os 95 k libgomp x86_64 4.8.5-4.el7 os 130 k Transaction Summary ============================================================================================================================================================== Install 1 Package (+3 Dependent packages) Upgrade ( 3 Dependent packages) Total download size: 23 M Is this ok [y/d/N]: y Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. (1/7): cpp-4.8.5-4.el7.x86_64.rpm | 5.9 MB 00:00:01 (2/7): libgcc-4.8.5-4.el7.i686.rpm | 103 kB 00:00:00 (3/7): libgcc-4.8.5-4.el7.x86_64.rpm | 95 kB 00:00:00 (4/7): libgomp-4.8.5-4.el7.x86_64.rpm | 130 kB 00:00:00 (5/7): libmpc-1.0.1-3.el7.x86_64.rpm | 51 kB 00:00:00 (6/7): mpfr-3.1.1-4.el7.x86_64.rpm | 203 kB 00:00:00 (7/7): gcc-4.8.5-4.el7.x86_64.rpm | 16 MB 00:00:01 -------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 15 MB/s | 23 MB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mpfr-3.1.1-4.el7.x86_64 1/10 Installing : libmpc-1.0.1-3.el7.x86_64 2/10 Installing : cpp-4.8.5-4.el7.x86_64 3/10 Updating : libgcc-4.8.5-4.el7.x86_64 4/10 Updating : libgomp-4.8.5-4.el7.x86_64 5/10 Installing : gcc-4.8.5-4.el7.x86_64 6/10 Updating : libgcc-4.8.5-4.el7.i686 7/10 Cleanup : libgcc-4.8.3-9.el7 8/10 Cleanup : libgcc-4.8.3-9.el7 9/10 Cleanup : libgomp-4.8.3-9.el7.x86_64 10/10 Verifying : libgcc-4.8.5-4.el7.i686 1/10 Verifying : libgomp-4.8.5-4.el7.x86_64 2/10 Verifying : gcc-4.8.5-4.el7.x86_64 3/10 Verifying : cpp-4.8.5-4.el7.x86_64 4/10 Verifying : libgcc-4.8.5-4.el7.x86_64 5/10 Verifying : mpfr-3.1.1-4.el7.x86_64 6/10 Verifying : libmpc-1.0.1-3.el7.x86_64 7/10 Verifying : libgcc-4.8.3-9.el7.i686 8/10 Verifying : libgcc-4.8.3-9.el7.x86_64 9/10 Verifying : libgomp-4.8.3-9.el7.x86_64 10/10 Installed: gcc.x86_64 0:4.8.5-4.el7 Dependency Installed: cpp.x86_64 0:4.8.5-4.el7 libmpc.x86_64 0:1.0.1-3.el7 mpfr.x86_64 0:3.1.1-4.el7 Dependency Updated: libgcc.i686 0:4.8.5-4.el7 libgcc.x86_64 0:4.8.5-4.el7 libgomp.x86_64 0:4.8.5-4.el7 Complete!
补充:
[root@VM_7_88_centos redis-stable]# yum -h Loaded plugins: fastestmirror, langpacks Usage: yum [options] COMMAND List of Commands: check Check for problems in the rpmdb check-update Check for available package updates clean Remove cached data deplist List a package's dependencies distribution-synchronization Synchronize installed packages to the latest available versions downgrade downgrade a package erase Remove a package or packages from your system fs Creates filesystem snapshots, or lists/deletes current snapshots. fssnapshot Creates filesystem snapshots, or lists/deletes current snapshots. groups Display, or use, the groups information help Display a helpful usage message history Display, or use, the transaction history info Display details about a package or group of packages install Install a package or packages on your system langavailable Check available languages langinfo List languages information langinstall Install appropriate language packs for a language langlist List installed languages langremove Remove installed language packs for a language list List a package or groups of packages load-transaction load a saved transaction from filename makecache Generate the metadata cache provides Find what package provides the given value reinstall reinstall a package repo-pkgs Treat a repo. as a group of packages, so we can install/remove all of them repolist Display the configured software repositories search Search package details for the given string shell Run an interactive yum shell swap Simple way to swap packages, instead of using shell update Update a package or packages on your system update-minimal Works like upgrade, but goes to the 'newest' package match which fixes a problem that affects your system updateinfo Acts on repository update information upgrade Update packages taking obsoletes into account version Display a version for the machine and/or available repos. Options: -h, --help show this help message and exit -t, --tolerant be tolerant of errors -C, --cacheonly run entirely from system cache, don't update cache -c [config file], --config=[config file] config file location -R [minutes], --randomwait=[minutes] maximum command wait time -d [debug level], --debuglevel=[debug level] debugging output level --showduplicates show duplicates, in repos, in list/search commands -e [error level], --errorlevel=[error level] error output level --rpmverbosity=[debug level name] debugging output level for rpm -q, --quiet quiet operation -v, --verbose verbose operation -y, --assumeyes answer yes for all questions --assumeno answer no for all questions --version show Yum version and exit --installroot=[path] set install root --enablerepo=[repo] enable one or more repositories (wildcards allowed) --disablerepo=[repo] disable one or more repositories (wildcards allowed) -x [package], --exclude=[package] exclude package(s) by name or glob --disableexcludes=[repo] disable exclude from main, for a repo or for everything --disableincludes=[repo] disable includepkgs for a repo or for everything --obsoletes enable obsoletes processing during updates --noplugins disable Yum plugins --nogpgcheck disable gpg signature checking --disableplugin=[plugin] disable plugins by name --enableplugin=[plugin] enable plugins by name --skip-broken skip packages with depsolving problems --color=COLOR control whether color is used --releasever=RELEASEVER set value of $releasever in yum config and repo files --downloadonly don't update, just download --downloaddir=DLDIR specifies an alternate directory to store packages --setopt=SETOPTS set arbitrary config and repo options --bugfix Include bugfix relevant packages, in updates --security Include security relevant packages, in updates --advisory=ADVS, --advisories=ADVS Include packages needed to fix the given advisory, in updates --bzs=BZS Include packages needed to fix the given BZ, in updates --cves=CVES Include packages needed to fix the given CVE, in updates --sec-severity=SEVS, --secseverity=SEVS Include security relevant packages matching the severity, in updates Plugin Options:
问题:/bin/sh: cc: command not found
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
上网查找问题过程中,恍然,还没看README
Where to find complete Redis documentation? ------------------------------------------- This README is just a fast "quick start" document. You can find more detailed documentation at http://redis.io Building Redis -------------- Redis can be compiled and used on Linux, OSX, OpenBSD, NetBSD, FreeBSD. We support big endian and little endian architectures. It may compile on Solaris derived systems (for instance SmartOS) but our support for this platform is "best effort" and Redis is not guaranteed to work as well as in Linux, OSX, and *BSD there. It is as simple as: % make You can run a 32 bit Redis binary using: % make 32bit After building Redis is a good idea to test it, using: % make test Fixing build problems with dependencies or cached build options —-------- Redis has some dependencies which are included into the "deps" directory. "make" does not rebuild dependencies automatically, even if something in the source code of dependencies is changes. When you update the source code with `git pull` or when code inside the dependencies tree is modified in any other way, make sure to use the following command in order to really clean everything and rebuild from scratch: make distclean This will clean: jemalloc, lua, hiredis, linenoise. Also if you force certain build options like 32bit target, no C compiler optimizations (for debugging purposes), and other similar build time options, those options are cached indefinitely until you issue a "make distclean" command. Fixing problems building 32 bit binaries --------- If after building Redis with a 32 bit target you need to rebuild it with a 64 bit target, or the other way around, you need to perform a "make distclean" in the root directory of the Redis distribution. In case of build errors when trying to build a 32 bit binary of Redis, try the following steps: * Install the packages libc6-dev-i386 (also try g++-multilib). * Try using the following command line instead of "make 32bit": make CFLAGS="-m32 -march=native" LDFLAGS="-m32" Allocator --------- Selecting a non-default memory allocator when building Redis is done by setting the `MALLOC` environment variable. Redis is compiled and linked against libc malloc by default, with the exception of jemalloc being the default on Linux systems. This default was picked because jemalloc has proven to have fewer fragmentation problems than libc malloc. To force compiling against libc malloc, use: % make MALLOC=libc To compile against jemalloc on Mac OS X systems, use: % make MALLOC=jemalloc Verbose build ------------- Redis will build with a user friendly colorized output by default. If you want to see a more verbose output use the following: % make V=1 Running Redis ------------- To run Redis with the default configuration just type: % cd src % ./redis-server If you want to provide your redis.conf, you have to run it using an additional parameter (the path of the configuration file): % cd src % ./redis-server /path/to/redis.conf It is possible to alter the Redis configuration passing parameters directly as options using the command line. Examples: % ./redis-server --port 9999 --slaveof 127.0.0.1 6379 % ./redis-server /etc/redis/6379.conf --loglevel debug All the options in redis.conf are also supported as options using the command line, with exactly the same name. Playing with Redis ------------------ You can use redis-cli to play with Redis. Start a redis-server instance, then in another terminal try the following: % cd src % ./redis-cli redis> ping PONG redis> set foo bar OK redis> get foo "bar" redis> incr mycounter (integer) 1 redis> incr mycounter (integer) 2 redis> You can find the list of all the available commands here: http://redis.io/commands Installing Redis ----------------- In order to install Redis binaries into /usr/local/bin just use: % make install You can use "make PREFIX=/some/other/directory install" if you wish to use a different destination. Make install will just install binaries in your system, but will not configure init scripts and configuration files in the appropriate place. This is not needed if you want just to play a bit with Redis, but if you are installing it the proper way for a production system, we have a script doing this for Ubuntu and Debian systems: % cd utils % ./install_server.sh The script will ask you a few questions and will setup everything you need to run Redis properly as a background daemon that will start again on system reboots. You'll be able to stop and start Redis using the script named /etc/init.d/redis_<portnumber>, for instance /etc/init.d/redis_6379. Code contributions --- Note: by contributing code to the Redis project in any form, including sending a pull request via Github, a code fragment or patch via private email or public discussion groups, you agree to release your code under the terms of the BSD license that you can find in the COPYING file included in the Redis source distribution. Please see the CONTRIBUTING file in this source distribution for more information. Enjoy!
解决:make MALLOC=libc
如下:
[root@VM_7_88_centos redis-stable]# make MALLOC=libc cd src && make all make[1]: Entering directory `/opt/redis/redis-stable/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 `/opt/redis/redis-stable/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 `/opt/redis/redis-stable/deps' (rm -f .make-*) echo STD=-std=c99 -pedantic >> .make-settings echo WARN=-Wall -W >> .make-settings echo OPT=-O2 >> .make-settings echo MALLOC=libc >> .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 -W -O2 -g -ggdb -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src >> .make-settings echo PREV_FINAL_LDFLAGS= -g -ggdb -rdynamic >> .make-settings (cd ../deps && make hiredis linenoise lua) make[2]: Entering directory `/opt/redis/redis-stable/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-cflags) (echo "" > .make-ldflags) MAKE hiredis cd hiredis && make static make[3]: Entering directory `/opt/redis/redis-stable/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 `/opt/redis/redis-stable/deps/hiredis' MAKE linenoise cd linenoise && make make[3]: Entering directory `/opt/redis/redis-stable/deps/linenoise' cc -Wall -Os -g -c linenoise.c make[3]: Leaving directory `/opt/redis/redis-stable/deps/linenoise' MAKE lua cd lua/src && make all CFLAGS="-O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL " MYLDFLAGS="" AR="ar rcu" make[3]: Entering directory `/opt/redis/redis-stable/deps/lua/src' cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lapi.o lapi.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lcode.o lcode.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ldebug.o ldebug.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ldo.o ldo.c ldo.c: In function 'f_parser': ldo.c:496:7: warning: unused variable 'c' [-Wunused-variable] int c = luaZ_lookahead(p->z); ^ cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ldump.o ldump.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lfunc.o lfunc.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lgc.o lgc.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o llex.o llex.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lmem.o lmem.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lobject.o lobject.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lopcodes.o lopcodes.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lparser.o lparser.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lstate.o lstate.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lstring.o lstring.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ltable.o ltable.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ltm.o ltm.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lundump.o lundump.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lvm.o lvm.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lzio.o lzio.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o strbuf.o strbuf.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o fpconv.o fpconv.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lauxlib.o lauxlib.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lbaselib.o lbaselib.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ldblib.o ldblib.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o liolib.o liolib.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lmathlib.o lmathlib.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o loslib.o loslib.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o ltablib.o ltablib.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lstrlib.o lstrlib.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o loadlib.o loadlib.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o linit.o linit.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lua_cjson.o lua_cjson.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lua_struct.o lua_struct.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lua_cmsgpack.o lua_cmsgpack.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lua_bit.o lua_bit.c 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 ranlib liblua.a cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o lua.o lua.c cc -o lua lua.o liblua.a -lm cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o luac.o luac.c cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -c -o print.o print.c cc -o luac luac.o print.o liblua.a -lm make[3]: Leaving directory `/opt/redis/redis-stable/deps/lua/src' make[2]: Leaving directory `/opt/redis/redis-stable/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 cluster.o CC crc16.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 CC notify.o CC setproctitle.o CC blocked.o CC hyperloglog.o CC latency.o CC sparkline.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: It's a good idea to run 'make test' ;) make[1]: Leaving directory `/opt/redis/redis-stable/src'
运行 make test 出现问题:
[root@VM_7_88_centos redis-stable]# make test cd src && make test make[1]: Entering directory `/opt/redis/redis-stable/src' You need tcl 8.5 or newer in order to run the Redis test make[1]: *** [test] Error 1 make[1]: Leaving directory `/opt/redis/redis-stable/src' make: *** [test] Error 2
解决办法:yum install tcl
[root@VM_7_88_centos src]# yum install tcl Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package tcl.x86_64 1:8.5.13-8.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================== Installing: tcl x86_64 1:8.5.13-8.el7 os 1.9 M Transaction Summary ============================================================================================================================================================== Install 1 Package Total download size: 1.9 M Installed size: 4.4 M Is this ok [y/d/N]: y Downloading packages: tcl-8.5.13-8.el7.x86_64.rpm | 1.9 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:tcl-8.5.13-8.el7.x86_64 1/1 Verifying : 1:tcl-8.5.13-8.el7.x86_64 1/1 Installed: tcl.x86_64 1:8.5.13-8.el7 Complete!
再次 make test
Execution time of different units: 1 seconds - unit/printver 2 seconds - unit/scan 3 seconds - unit/multi 3 seconds - unit/quit 4 seconds - unit/auth 5 seconds - unit/protocol 13 seconds - unit/expire 24 seconds - unit/type/list 41 seconds - unit/other 41 seconds - unit/type/list-2 41 seconds - unit/type/hash 5 seconds - integration/logging 4 seconds - unit/pubsub 11 seconds - integration/convert-zipmap-hash-on-load 29 seconds - integration/aof 13 seconds - integration/rdb 5 seconds - unit/slowlog 4 seconds - unit/introspection 5 seconds - unit/limits 65 seconds - unit/type/set 68 seconds - unit/dump 71 seconds - unit/aofrw 25 seconds - unit/scripting 77 seconds - unit/type/zset 77 seconds - integration/replication-2 84 seconds - unit/sort 30 seconds - unit/bitops 39 seconds - unit/maxmemory 93 seconds - unit/basic 30 seconds - unit/memefficiency 98 seconds - unit/type/list-3 128 seconds - integration/replication-3 133 seconds - integration/replication-4 70 seconds - unit/hyperloglog 158 seconds - integration/replication-psync 171 seconds - integration/replication 117 seconds - unit/obuf-limits \o/ All tests passed without errors! Cleanup: may take some time... OK
运行:
cd src
./redis-server
[root@VM_7_88_centos src]# ./redis-server 24864:C 17 Mar 14:53:33.741 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 3.0.7 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 24864 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 24864:M 17 Mar 14:53:33.742 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 24864:M 17 Mar 14:53:33.742 # Server started, Redis version 3.0.7 24864:M 17 Mar 14:53:33.742 # 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. 24864:M 17 Mar 14:53:33.742 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. 24864:M 17 Mar 14:53:33.742 * The server is now ready to accept connections on port 6379
后台运行 ./redis-server &
测试:
./redis-cli ping
[root@VM_7_88_centos src]# ./redis-cli ping PONG
进入客户端模式
[root@VM_7_88_centos src]# ./redis-cli 127.0.0.1:6379> ping PONG 127.0.0.1:6379> set mykey 123456 OK 127.0.0.1:6379> get mykey "123456" 127.0.0.1:6379>
关闭redis服务器
[root@VM_7_88_centos src]# ./redis-cli 127.0.0.1:6379> SHUTDOWN 25003:M 17 Mar 15:03:23.255 # User requested shutdown... 25003:M 17 Mar 15:03:23.255 * Saving the final RDB snapshot before exiting. 25003:M 17 Mar 15:03:23.295 * DB saved on disk 25003:M 17 Mar 15:03:23.295 # Redis is now ready to exit, bye bye... not connected>
安全机制待续。。。