[root@web02 jifeng]# wget http://download.redis.io/releases/redis-3.0.2.tar.gz
[root@web02 jifeng]# ls
redis-3.0.2.tar.gz
2:解壓
[root@web02 jifeng]# $ tar xzf redis-3.0.2.tar.gz
[root@web02 jifeng]# ls
redis-3.0.2 redis-3.0.2.tar.gz
3:編譯
make MALLOC=libc
[root@web02 jifeng]# cd redis-3.0.2
[root@web02 redis-3.0.2]# ls
00-RELEASENOTES COPYING Makefile redis.conf runtest-sentinel tests
BUGS deps MANIFESTO runtest sentinel.conf utils
CONTRIBUTING INSTALL README runtest-cluster src
[root@web02 redis-3.0.2]# ls -ls
total 144
28 -rw-rw-r-- 1 root root 26772 Jun 4 17:35 00-RELEASENOTES4 -rw-rw-r-- 1 root root 53 Jun 4 17:35 BUGS4 -rw-rw-r-- 1 root root 1439 Jun 4 17:35 CONTRIBUTING4 -rw-rw-r-- 1 root root 1487 Jun 4 17:35 COPYING4 drwxrwxr-x 6 root root 4096 Jun 4 17:35 deps4 -rw-rw-r-- 1 root root 11 Jun 4 17:35 INSTALL4 -rw-rw-r-- 1 root root 151 Jun 4 17:35 Makefile8 -rw-rw-r-- 1 root root 4223 Jun 4 17:35 MANIFESTO8 -rw-rw-r-- 1 root root 5201 Jun 4 17:35 README
44 -rw-rw-r-- 1 root root 41403 Jun 4 17:35 redis.conf4 -rwxrwxr-x 1 root root 271 Jun 4 17:35 runtest4 -rwxrwxr-x 1 root root 280 Jun 4 17:35 runtest-cluster4 -rwxrwxr-x 1 root root 281 Jun 4 17:35 runtest-sentinel8 -rw-rw-r-- 1 root root 7109 Jun 4 17:35 sentinel.conf4 drwxrwxr-x 2 root root 4096 Jun 4 17:35 src4 drwxrwxr-x 10 root root 4096 Jun 4 17:35 tests4 drwxrwxr-x 5 root root 4096 Jun 4 17:35 utils[root@web02 redis-3.0.2]# make MALLOC=libc
cd src && make all
make[1]: Entering directory `/home/jifeng/redis-3.0.2/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 `/home/jifeng/redis-3.0.2/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 `/home/jifeng/redis-3.0.2/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 `/home/jifeng/redis-3.0.2/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 `/home/jifeng/redis-3.0.2/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 `/home/jifeng/redis-3.0.2/deps/hiredis'
MAKE linenoise
cd linenoise && make
make[3]: Entering directory `/home/jifeng/redis-3.0.2/deps/linenoise'
cc -Wall -Os -g -c linenoise.c
make[3]: Leaving directory `/home/jifeng/redis-3.0.2/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 `/home/jifeng/redis-3.0.2/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: warning: unused variable ‘c’
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
liblua.a(loslib.o): In function `os_tmpname':
loslib.c:(.text+0x35): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
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 `/home/jifeng/redis-3.0.2/deps/lua/src'
make[2]: Leaving directory `/home/jifeng/redis-3.0.2/deps'CC adlist.oCC ae.oCC anet.o
anet.c: In function ‘anetSockName’:
anet.c:605: warning: dereferencing pointer ‘s’ does break strict-aliasing rules
anet.c:603: note: initialized from here
anet.c:609: warning: dereferencing pointer ‘s’ does break strict-aliasing rules
anet.c:607: note: initialized from here
anet.c: In function ‘anetPeerToString’:
anet.c:566: warning: dereferencing pointer ‘s’ does break strict-aliasing rules
anet.c:564: note: initialized from here
anet.c:570: warning: dereferencing pointer ‘s’ does break strict-aliasing rules
anet.c:568: note: initialized from here
anet.c: In function ‘anetTcpAccept’:
anet.c:537: warning: dereferencing pointer ‘s’ does break strict-aliasing rules
anet.c:535: note: initialized from here
anet.c:541: warning: dereferencing pointer ‘s’ does break strict-aliasing rules
anet.c:539: note: initialized from hereCC dict.oCC redis.oCC sds.oCC zmalloc.oCC lzf_c.oCC lzf_d.oCC pqsort.oCC zipmap.oCC sha1.oCC ziplist.oCC release.oCC networking.oCC util.oCC object.oCC db.o
db.c: In function ‘scanGenericCommand’:
db.c:428: warning: ‘pat’ may be used uninitialized in this function
db.c:429: warning: ‘patlen’ may be used uninitialized in this functionCC replication.oCC rdb.oCC t_string.oCC t_list.oCC t_set.oCC t_zset.oCC t_hash.oCC config.oCC aof.oCC pubsub.oCC multi.oCC debug.oCC sort.oCC intset.oCC syncio.oCC cluster.oCC crc16.oCC endianconv.oCC slowlog.oCC scripting.oCC bio.oCC rio.oCC rand.oCC memtest.oCC crc64.oCC bitops.oCC sentinel.oCC notify.oCC setproctitle.oCC blocked.oCC hyperloglog.oCC latency.oCC sparkline.oLINK redis-serverINSTALL redis-sentinelCC redis-cli.oLINK redis-cliCC redis-benchmark.oLINK redis-benchmarkCC redis-check-dump.oLINK redis-check-dumpCC redis-check-aof.oLINK redis-check-aofHint: It's a good idea to run 'make test' ;)make[1]: Leaving directory `/home/jifeng/redis-3.0.2/src'
4:運行
[root@web02 redis-3.0.2]# ./src/redis-server
3442:C 19 Jun 15:12:54.222 # Warning: no config file specified, using the default config. In order to specify a config file use ./src/redis-server /path/to/redis.conf
3442:M 19 Jun 15:12:54.223 * Increased maximum number of open files to 10032 (it was originally set to 1024)._._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 3.0.2 (00000000/0) 64 bit.-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379| `-._ `._ / _.-' | PID: 3442`-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 3442:M 19 Jun 15:12:54.224 # Server started, Redis version 3.0.2
3442:M 19 Jun 15:12:54.224 # 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.
3442:M 19 Jun 15:12:54.224 # 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.
3442:M 19 Jun 15:12:54.224 * The server is now ready to accept connections on port 6379