Redis 简单入门
安装 Redis
一般系统都会有软件管理工具,但是通常版本都不会太新,况且 Redis 的安装很简单,因此下面使用源码的安装方式。
- 下载源码
wget http://download.redis.io/releases/redis-3.2.8.tar.gz
- 解压
tar -zxf redis-3.2.8.tar.gz
- 创建软连接
ln -s redis-3.2.8 redis
- 进入 redis 目录
cd redis
- 编译
make
- 安装
make install
安装完成后,在 src 和 /usr/local/bin 目录下就会多了几个以 redis-
开头的可执行文件。
可执行文件 | 说明 |
---|---|
redis-server | 启动 Redis。 |
redis-cli | Redis 命令行客户端 |
redis-benchmark | Redis 基准测试工具 |
redis-check-aof | Redis AOF 持久化文件检测与修复工具 |
redis-check-dump | Redis RDB 持久化文件检测与修复工具 |
redis-sentinel | 启动 Redis Sentinel |
查看安装的 Redis 版本是否正确:redis-cli -v
[root@glon redis]# cd
[root@glon ~]# redis-cli -v
redis-cli 3.2.8
启动 Redis
默认配置启动: redis-server
会话1:
[root@glon ~]# redis-server
12746:C 10 Mar 08:56:02.401 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
12746:M 10 Mar 08:56:02.403 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.8 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 12746
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
12746:M 10 Mar 08:56:02.446 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
12746:M 10 Mar 08:56:02.446 # Server started, Redis version 3.2.8
12746:M 10 Mar 08:56:02.446 # 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.
12746:M 10 Mar 08:56:02.447 # 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.
12746:M 10 Mar 08:56:02.447 * The server is now ready to accept connections on port 6379
会话2:
[root@glon ~]# ps aux | grep redis
root 12746 0.2 0.7 133536 7856 pts/1 Sl+ 08:56 0:00 redis-server *:6379
root 12857 0.0 0.0 103312 876 pts/0 S+ 09:01 0:00 grep redis
直接使用 redis-server 启动,用的是 /usr/local/redis 目录下的 redis.conf 配置文件,里面就是默认的配置。
启动 Redis 后,会打印出一些日志,通过日志可以看到一些信息,从上面的输出中可以看到:
- 当前的 Redis 版本的是 3.2.8;
- Redis 的默认端口是 6379;
- Redis 建议要使用配置文件来启动;
运行时配置启动: redis-server --key1 value1 --key2 value2 ... --keyN valueN
示例:指定端口启动
会话1:
[root@glon ~]# redis-server --port 3306
12858:M 10 Mar 09:03:08.190 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.8 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 3306
| `-._ `._ / _.-' | PID: 12858
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
12858:M 10 Mar 09:03:08.237 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
12858:M 10 Mar 09:03:08.237 # Server started, Redis version 3.2.8
12858:M 10 Mar 09:03:08.238 # 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.
12858:M 10 Mar 09:03:08.238 # 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.
12858:M 10 Mar 09:03:08.238 * DB loaded from disk: 0.000 seconds
12858:M 10 Mar 09:03:08.238 * The server is now ready to accept connections on port 3306
会话2:
[root@glon ~]# ps aux | grep redis
root 12858 0.2 0.7 133536 7880 pts/1 Sl+ 09:03 0:00 redis-server *:3306
root 12862 0.0 0.0 103312 876 pts/0 S+ 09:03 0:00 grep redis
可以看到,Redis 监听的端口是 3306,而不是默认的 6379 了。
在简单测试或临时使用时可以使用这种方式。
当然,如果需要指定的配置项很多的话,我想,不用说,你也会选择使用下面这种启动方式。
指定配置文件启动: redis-server /path/to/conf
示例:修改配置文件中的端口,然后启动
会话1:
[root@glon ~]# redis-server /usr/local/redis/redis.conf
12865:M 10 Mar 09:05:59.258 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.8 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 63790
| `-._ `._ / _.-' | PID: 12865
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
12865:M 10 Mar 09:05:59.277 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
12865:M 10 Mar 09:05:59.277 # Server started, Redis version 3.2.8
12865:M 10 Mar 09:05:59.277 # 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.
12865:M 10 Mar 09:05:59.277 # 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.
12865:M 10 Mar 09:05:59.277 * DB loaded from disk: 0.000 seconds
12865:M 10 Mar 09:05:59.277 * The server is now ready to accept connections on port 63790
会话2:
[root@glon ~]# ps aux | grep redis
root 12865 0.2 0.7 133536 7892 pts/1 Sl+ 09:31 0:00 redis-server 127.0.0.1:63790
root 12869 0.0 0.0 103312 876 pts/0 S+ 09:33 0:00 grep redis
指定配置文件启动是推荐使用的一种方式,一方面持久化配置,方便以后查阅,另一方面,一台服务器上通常都会部署多个实例,指定配置文件更方便管理。
使用命令行客户端来进行交互
交互模式:redis-cli -h ip/host -p port
[root@glon ~]# redis-cli -h localhost -p 63790
localhost:63790> keys *
(empty list or set)
localhost:63790> set name glon
OK
localhost:63790> get name
"glon"
localhost:63790>
如果不指定-h 和 -p,默认 -h 是 127.0.0.1,-p 是 6379。
注意:选项和值之间用空格隔开。
直接执行命令并得到结果,不进入交互模式:redis-cli -h ip/host -p port command
[root@glon ~]# redis-cli -h localhost -p 63790 get name
"glon"
退出交互模式:exit
[root@glon ~]# redis-cli -h localhost -p 63790
localhost:63790> keys *
(empty list or set)
localhost:63790> set name glon
OK
localhost:63790> get name
"glon"
localhost:63790> exit
[root@glon ~]#
停止 Redis 服务:redis-cli shutdown
客户端:
[root@glon ~]# redis-cli -h localhost -p 63790 shutdown
[root@glon ~]#
服务端:
12876:M 10 Mar 09:42:50.257 # User requested shutdown...
12876:M 10 Mar 09:42:50.257 * Saving the final RDB snapshot before exiting.
12876:M 10 Mar 09:42:50.268 * DB saved on disk
12876:M 10 Mar 09:42:50.268 * Removing the pid file.
12876:M 10 Mar 09:42:50.268 # Redis is now ready to exit, bye bye...
从服务端输出的日志可以看到,整个关闭的执行过程:
- 客户端发出 shutdown 命令行客户端
- 执行 RDB 持久化操作
- 保存 RDB 文件到磁盘上
- 移除 pid 文件
- 关闭 Redis 服务
默认在关闭的时候会保存 RDB 持久化文件,可以指定在关闭服务之前是否保存 RDB 文件,加速关闭服务。
redis-cli shutdown nosave|save
不建议简单粗暴地使用 kill -9 强制杀死 Redis 服务,这样不但不会做持久化的操作,而且还可能会造成未来得及持久化的数据丢失数据。
安装过程
[root@glon ~]# wget http://download.redis.io/releases/redis-3.2.8.tar.gz
--2017-03-10 07:01:15-- http://download.redis.io/releases/redis-3.2.8.tar.gz
Resolving download.redis.io... 109.74.203.151
Connecting to download.redis.io|109.74.203.151|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1547237 (1.5M) [application/x-gzip]
Saving to: “redis-3.2.8.tar.gz”
100%[===================================================================================================================================================>] 1,547,237 306K/s in 5.1s
2017-03-10 07:01:21 (297 KB/s) - “redis-3.2.8.tar.gz” saved [1547237/1547237]
[root@glon ~]#
[root@glon ~]#
[root@glon ~]# tar -zxf redis-3.2.8.tar.gz
[root@glon ~]#
[root@glon ~]#
[root@glon ~]# ls
redis-3.2.8 redis-3.2.8.tar.gz
[root@glon ~]#
[root@glon ~]#
[root@glon ~]# sudo mv redis-3.2.8 /opt/redis/
[root@glon ~]#
[root@glon ~]#
[root@glon ~]# ls /opt/
mysql redis VBoxGuestAdditions-5.0.16 VBoxGuestAdditions-5.0.26
[root@glon ~]#
[root@glon ~]#
[root@glon ~]# cd /usr/local/
[root@glon local]# sudo ln -s /opt/redis/redis-3.2.8 redis
[root@glon redis]#
[root@glon redis]#
[root@glon local]# ll
total 40
drwxr-xr-x. 2 root root 4096 Sep 23 2011 bin
drwxr-xr-x. 2 root root 4096 Sep 23 2011 etc
drwxr-xr-x. 2 root root 4096 Sep 23 2011 games
drwxr-xr-x. 2 root root 4096 Sep 23 2011 include
drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib
drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib64
drwxr-xr-x. 2 root root 4096 Sep 23 2011 libexec
lrwxrwxrwx. 1 mysql mysql 45 Jan 4 08:30 mysql -> /opt/mysql/mysql-5.7.17-linux-glibc2.5-x86_64
lrwxrwxrwx. 1 root root 22 Mar 10 07:04 redis -> /opt/redis/redis-3.2.8
drwxr-xr-x. 2 root root 4096 Sep 23 2011 sbin
drwxr-xr-x. 5 root root 4096 Mar 29 2016 share
drwxr-xr-x. 2 root root 4096 Sep 23 2011 src
[root@glon local]#
[root@glon redis]#
[root@glon local]# cd redis/
[root@glon redis]#
[root@glon redis]# ls
00-RELEASENOTES BUGS CONTRIBUTING COPYING deps INSTALL Makefile MANIFESTO README.md redis.conf runtest runtest-cluster runtest-sentinel sentinel.conf src tests utils
[root@glon redis]#
[root@glon redis]#
[root@glon redis]# ls src/
adlist.c anet.c cluster.c debug.c geo.h lzf_d.c networking.c rand.c redis-cli.c sds.c slowlog.c t_hash.c version.h
adlist.h anet.h cluster.h debugmacro.h help.h lzf.h notify.c rand.h redis-trib.rb sds.h slowlog.h t_list.c ziplist.c
ae.c aof.c config.c dict.c hyperloglog.c lzfP.h object.c rdb.c release.c sentinel.c solarisfixes.h t_set.c ziplist.h
ae_epoll.c asciilogo.h config.h dict.h intset.c Makefile pqsort.c rdb.h replication.c server.c sort.c t_string.c zipmap.c
ae_evport.c bio.c crc16.c endianconv.c intset.h Makefile.dep pqsort.h redisassert.h rio.c server.h sparkline.c t_zset.c zipmap.h
ae.h bio.h crc64.c endianconv.h latency.c memtest.c pubsub.c redis-benchmark.c rio.h setproctitle.c sparkline.h util.c zmalloc.c
ae_kqueue.c bitops.c crc64.h fmacros.h latency.h mkreleasehdr.sh quicklist.c redis-check-aof.c scripting.c sha1.c syncio.c util.h zmalloc.h
ae_select.c blocked.c db.c geo.c lzf_c.c multi.c quicklist.h redis-check-rdb.c sdsalloc.h sha1.h testhelp.h valgrind.sup
[root@glon redis]#
[root@glon redis]#
[root@glon redis]# ls /usr/local/bin/
[root@glon redis]#
[root@glon redis]#
[root@glon redis]# make
cd src && make all
make[1]: Entering directory `/opt/redis/redis-3.2.8/src'
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html
(cd ../deps && make distclean)
make[2]: Entering directory `/opt/redis/redis-3.2.8/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd geohash-int && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: Leaving directory `/opt/redis/redis-3.2.8/deps'
(rm -f .make-*)
echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings
echo WARN=-Wall -W >> .make-settings
echo OPT=-O2 >> .make-settings
echo MALLOC=jemalloc >> .make-settings
echo CFLAGS= >> .make-settings
echo LDFLAGS= >> .make-settings
echo REDIS_CFLAGS= >> .make-settings
echo REDIS_LDFLAGS= >> .make-settings
echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -DREDIS_STATIC='' -Wall -W -O2 -g -ggdb -I../deps/geohash-int -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
echo PREV_FINAL_LDFLAGS= -g -ggdb -rdynamic >> .make-settings
(cd ../deps && make hiredis linenoise lua geohash-int jemalloc)
make[2]: Entering directory `/opt/redis/redis-3.2.8/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd geohash-int && 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 `/opt/redis/redis-3.2.8/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-3.2.8/deps/hiredis'
MAKE linenoise
cd linenoise && make
make[3]: Entering directory `/opt/redis/redis-3.2.8/deps/linenoise'
cc -Wall -Os -g -c linenoise.c
make[3]: Leaving directory `/opt/redis/redis-3.2.8/deps/linenoise'
MAKE lua
cd lua/src && make all CFLAGS="-O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' " MYLDFLAGS="" AR="ar rcu"
make[3]: Entering directory `/opt/redis/redis-3.2.8/deps/lua/src'
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lapi.o lapi.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lcode.o lcode.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ldebug.o ldebug.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -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 -DREDIS_STATIC='' -c -o ldump.o ldump.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lfunc.o lfunc.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lgc.o lgc.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o llex.o llex.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lmem.o lmem.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lobject.o lobject.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lopcodes.o lopcodes.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lparser.o lparser.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lstate.o lstate.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lstring.o lstring.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ltable.o ltable.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ltm.o ltm.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lundump.o lundump.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lvm.o lvm.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lzio.o lzio.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o strbuf.o strbuf.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o fpconv.o fpconv.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lauxlib.o lauxlib.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lbaselib.o lbaselib.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ldblib.o ldblib.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o liolib.o liolib.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lmathlib.o lmathlib.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o loslib.o loslib.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ltablib.o ltablib.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lstrlib.o lstrlib.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o loadlib.o loadlib.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o linit.o linit.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lua_cjson.o lua_cjson.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lua_struct.o lua_struct.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lua_cmsgpack.o lua_cmsgpack.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -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 -DREDIS_STATIC='' -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 -DREDIS_STATIC='' -c -o luac.o luac.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o print.o print.c
cc -o luac luac.o print.o liblua.a -lm
make[3]: Leaving directory `/opt/redis/redis-3.2.8/deps/lua/src'
MAKE geohash-int
cd geohash-int && make
make[3]: Entering directory `/opt/redis/redis-3.2.8/deps/geohash-int'
cc -Wall -O2 -g -c geohash.c
cc -Wall -O2 -g -c geohash_helper.c
make[3]: Leaving directory `/opt/redis/redis-3.2.8/deps/geohash-int'
MAKE jemalloc
cd jemalloc && ./configure --with-lg-quantum=3 --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS="-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops " LDFLAGS=""
checking for xsltproc... false
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether byte ordering is bigendian... no
checking size of void *... 8
checking size of int... 4
checking size of long... 8
checking size of intmax_t... 8
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking whether pause instruction is compilable... yes
checking for ar... ar
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking whether malloc_usable_size definition can use const argument... no
checking whether __attribute__ syntax is compilable... yes
checking whether compiler supports -fvisibility=hidden... yes
checking whether compiler supports -Werror... yes
checking whether tls_model attribute is compilable... yes
checking whether compiler supports -Werror... yes
checking whether alloc_size attribute is compilable... yes
checking whether compiler supports -Werror... yes
checking whether format(gnu_printf, ...) attribute is compilable... yes
checking whether compiler supports -Werror... yes
checking whether format(printf, ...) attribute is compilable... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking for ld... /usr/bin/ld
checking for autoconf... false
checking for memalign... yes
checking for valloc... yes
checking configured backtracing method... N/A
checking for sbrk... yes
checking whether utrace(2) is compilable... no
checking whether valgrind is compilable... no
checking whether a program using __builtin_ffsl is compilable... yes
checking LG_PAGE... 12
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for pthread_create in -lpthread... yes
checking for library containing clock_gettime... -lrt
checking for secure_getenv... no
checking for issetugid... no
checking for _malloc_thread_cleanup... no
checking for _pthread_mutex_init_calloc_cb... no
checking for TLS... yes
checking whether C11 atomics is compilable... no
checking whether atomic(9) is compilable... no
checking whether Darwin OSAtomic*() is compilable... no
checking whether madvise(2) is compilable... yes
checking whether to force 32-bit __sync_{add,sub}_and_fetch()... no
checking whether to force 64-bit __sync_{add,sub}_and_fetch()... no
checking for __builtin_clz... yes
checking whether Darwin OSSpin*() is compilable... no
checking whether glibc malloc hook is compilable... yes
checking whether glibc memalign hook is compilable... yes
checking whether pthreads adaptive mutexes is compilable... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating jemalloc.pc
config.status: creating doc/html.xsl
config.status: creating doc/manpages.xsl
config.status: creating doc/jemalloc.xml
config.status: creating include/jemalloc/jemalloc_macros.h
config.status: creating include/jemalloc/jemalloc_protos.h
config.status: creating include/jemalloc/jemalloc_typedefs.h
config.status: creating include/jemalloc/internal/jemalloc_internal.h
config.status: creating test/test.sh
config.status: creating test/include/test/jemalloc_test.h
config.status: creating config.stamp
config.status: creating bin/jemalloc-config
config.status: creating bin/jemalloc.sh
config.status: creating bin/jeprof
config.status: creating include/jemalloc/jemalloc_defs.h
config.status: creating include/jemalloc/internal/jemalloc_internal_defs.h
config.status: creating test/include/test/jemalloc_test_defs.h
config.status: executing include/jemalloc/internal/private_namespace.h commands
config.status: executing include/jemalloc/internal/private_unnamespace.h commands
config.status: executing include/jemalloc/internal/public_symbols.txt commands
config.status: executing include/jemalloc/internal/public_namespace.h commands
config.status: executing include/jemalloc/internal/public_unnamespace.h commands
config.status: executing include/jemalloc/internal/size_classes.h commands
config.status: executing include/jemalloc/jemalloc_protos_jet.h commands
config.status: executing include/jemalloc/jemalloc_rename.h commands
config.status: executing include/jemalloc/jemalloc_mangle.h commands
config.status: executing include/jemalloc/jemalloc_mangle_jet.h commands
config.status: executing include/jemalloc/jemalloc.h commands
===============================================================================
jemalloc version : 4.0.3-0-ge9192eacf8935e29fc62fddc2701f7942b1cc02c
library revision : 2
CONFIG : --with-lg-quantum=3 --with-jemalloc-prefix=je_ --enable-cc-silence 'CFLAGS=-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops ' LDFLAGS=
CC : gcc
CFLAGS : -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -fvisibility=hidden
CPPFLAGS : -D_GNU_SOURCE -D_REENTRANT
LDFLAGS :
EXTRA_LDFLAGS :
LIBS : -lpthread
TESTLIBS : -lrt
RPATH_EXTRA :
XSLTPROC : false
XSLROOT :
PREFIX : /usr/local
BINDIR : /usr/local/bin
DATADIR : /usr/local/share
INCLUDEDIR : /usr/local/include
LIBDIR : /usr/local/lib
MANDIR : /usr/local/share/man
srcroot :
abs_srcroot : /usr/local/redis/deps/jemalloc/
objroot :
abs_objroot : /usr/local/redis/deps/jemalloc/
JEMALLOC_PREFIX : je_
JEMALLOC_PRIVATE_NAMESPACE
: je_
install_suffix :
autogen : 0
cc-silence : 1
debug : 0
code-coverage : 0
stats : 1
prof : 0
prof-libunwind : 0
prof-libgcc : 0
prof-gcc : 0
tcache : 1
fill : 1
utrace : 0
valgrind : 0
xmalloc : 0
munmap : 0
lazy_lock : 0
tls : 1
cache-oblivious : 1
===============================================================================
cd jemalloc && make CFLAGS="-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops " LDFLAGS="" lib/libjemalloc.a
make[3]: Entering directory `/opt/redis/redis-3.2.8/deps/jemalloc'
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/jemalloc.o src/jemalloc.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/arena.o src/arena.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/atomic.o src/atomic.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/base.o src/base.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/bitmap.o src/bitmap.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/chunk.o src/chunk.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/chunk_dss.o src/chunk_dss.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/chunk_mmap.o src/chunk_mmap.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/ckh.o src/ckh.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/ctl.o src/ctl.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/extent.o src/extent.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/hash.o src/hash.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/huge.o src/huge.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/mb.o src/mb.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/mutex.o src/mutex.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/pages.o src/pages.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/prof.o src/prof.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/quarantine.o src/quarantine.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/rtree.o src/rtree.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/stats.o src/stats.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tcache.o src/tcache.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/util.o src/util.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tsd.o src/tsd.c
ar crus lib/libjemalloc.a src/jemalloc.o src/arena.o src/atomic.o src/base.o src/bitmap.o src/chunk.o src/chunk_dss.o src/chunk_mmap.o src/ckh.o src/ctl.o src/extent.o src/hash.o src/huge.o src/mb.o src/mutex.o src/pages.o src/prof.o src/quarantine.o src/rtree.o src/stats.o src/tcache.o src/util.o src/tsd.o
make[3]: Leaving directory `/opt/redis/redis-3.2.8/deps/jemalloc'
make[2]: Leaving directory `/opt/redis/redis-3.2.8/deps'
CC adlist.o
CC quicklist.o
CC ae.o
In file included from ae.c:53:
ae_epoll.c: In function ‘aeApiAddEvent’:
ae_epoll.c:75: warning: missing initializer
ae_epoll.c:75: warning: (near initialization for ‘ee.data’)
ae_epoll.c: In function ‘aeApiDelEvent’:
ae_epoll.c:92: warning: missing initializer
ae_epoll.c:92: warning: (near initialization for ‘ee.data’)
CC anet.o
anet.c: In function ‘anetSockName’:
anet.c:640: warning: dereferencing pointer ‘s’ does break strict-aliasing rules
anet.c:638: note: initialized from here
anet.c:644: warning: dereferencing pointer ‘s’ does break strict-aliasing rules
anet.c:642: note: initialized from here
anet.c: In function ‘anetPeerToString’:
anet.c:584: warning: dereferencing pointer ‘s’ does break strict-aliasing rules
anet.c:582: note: initialized from here
anet.c:588: warning: dereferencing pointer ‘s’ does break strict-aliasing rules
anet.c:586: note: initialized from here
anet.c: In function ‘anetTcpAccept’:
anet.c:555: warning: dereferencing pointer ‘s’ does break strict-aliasing rules
anet.c:553: note: initialized from here
anet.c:559: warning: dereferencing pointer ‘s’ does break strict-aliasing rules
anet.c:557: note: initialized from here
CC dict.o
CC server.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
CC redis-check-rdb.o
CC geo.o
LINK redis-server
INSTALL redis-sentinel
CC redis-cli.o
LINK redis-cli
CC redis-benchmark.o
LINK redis-benchmark
INSTALL redis-check-rdb
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-3.2.8/src'
[root@glon redis]#
[root@glon redis]#
[root@glon redis]# ls
00-RELEASENOTES BUGS CONTRIBUTING COPYING deps INSTALL Makefile MANIFESTO README.md redis.conf runtest runtest-cluster runtest-sentinel sentinel.conf src tests utils
[root@glon redis]# ls src/
adlist.c aof.c config.c dict.c intset.c Makefile.dep pqsort.h redisassert.h redis-sentinel sdsalloc.h sha1.o t_hash.c valgrind.sup
adlist.h aof.o config.h dict.h intset.h memtest.c pqsort.o redis-benchmark redis-server sds.c slowlog.c t_hash.o version.h
adlist.o asciilogo.h config.o dict.o intset.o memtest.o pubsub.c redis-benchmark.c redis-trib.rb sds.h slowlog.h t_list.c ziplist.c
ae.c bio.c crc16.c endianconv.c latency.c mkreleasehdr.sh pubsub.o redis-benchmark.o release.c sds.o slowlog.o t_list.o ziplist.h
ae_epoll.c bio.h crc16.o endianconv.h latency.h multi.c quicklist.c redis-check-aof release.h sentinel.c solarisfixes.h t_set.c ziplist.o
ae_evport.c bio.o crc64.c endianconv.o latency.o multi.o quicklist.h redis-check-aof.c release.o sentinel.o sort.c t_set.o zipmap.c
ae.h bitops.c crc64.h fmacros.h lzf_c.c networking.c quicklist.o redis-check-aof.o replication.c server.c sort.o t_string.c zipmap.h
ae_kqueue.c bitops.o crc64.o geo.c lzf_c.o networking.o rand.c redis-check-rdb replication.o server.h sparkline.c t_string.o zipmap.o
ae.o blocked.c db.c geo.h lzf_d.c notify.c rand.h redis-check-rdb.c rio.c server.o sparkline.h t_zset.c zmalloc.c
ae_select.c blocked.o db.o geo.o lzf_d.o notify.o rand.o redis-check-rdb.o rio.h setproctitle.c sparkline.o t_zset.o zmalloc.h
anet.c cluster.c debug.c help.h lzf.h object.c rdb.c redis-cli rio.o setproctitle.o syncio.c util.c zmalloc.o
anet.h cluster.h debugmacro.h hyperloglog.c lzfP.h object.o rdb.h redis-cli.c scripting.c sha1.c syncio.o util.h
anet.o cluster.o debug.o hyperloglog.o Makefile pqsort.c rdb.o redis-cli.o scripting.o sha1.h testhelp.h util.o
[root@glon redis]#
[root@glon redis]#
[root@glon redis]# ls /usr/local/bin/
[root@glon redis]#
[root@glon redis]#
[root@glon redis]# make install
cd src && make install
make[1]: Entering directory `/opt/redis/redis-3.2.8/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 `/opt/redis/redis-3.2.8/src'
[root@glon redis]#
[root@glon redis]#
[root@glon redis]# ls
00-RELEASENOTES BUGS CONTRIBUTING COPYING deps INSTALL Makefile MANIFESTO README.md redis.conf runtest runtest-cluster runtest-sentinel sentinel.conf src tests utils
[root@glon redis]#
[root@glon redis]#
[root@glon redis]# ls src/
adlist.c aof.c config.c dict.c intset.c Makefile.dep pqsort.h redisassert.h redis-sentinel sdsalloc.h sha1.o t_hash.c valgrind.sup
adlist.h aof.o config.h dict.h intset.h memtest.c pqsort.o redis-benchmark redis-server sds.c slowlog.c t_hash.o version.h
adlist.o asciilogo.h config.o dict.o intset.o memtest.o pubsub.c redis-benchmark.c redis-trib.rb sds.h slowlog.h t_list.c ziplist.c
ae.c bio.c crc16.c endianconv.c latency.c mkreleasehdr.sh pubsub.o redis-benchmark.o release.c sds.o slowlog.o t_list.o ziplist.h
ae_epoll.c bio.h crc16.o endianconv.h latency.h multi.c quicklist.c redis-check-aof release.h sentinel.c solarisfixes.h t_set.c ziplist.o
ae_evport.c bio.o crc64.c endianconv.o latency.o multi.o quicklist.h redis-check-aof.c release.o sentinel.o sort.c t_set.o zipmap.c
ae.h bitops.c crc64.h fmacros.h lzf_c.c networking.c quicklist.o redis-check-aof.o replication.c server.c sort.o t_string.c zipmap.h
ae_kqueue.c bitops.o crc64.o geo.c lzf_c.o networking.o rand.c redis-check-rdb replication.o server.h sparkline.c t_string.o zipmap.o
ae.o blocked.c db.c geo.h lzf_d.c notify.c rand.h redis-check-rdb.c rio.c server.o sparkline.h t_zset.c zmalloc.c
ae_select.c blocked.o db.o geo.o lzf_d.o notify.o rand.o redis-check-rdb.o rio.h setproctitle.c sparkline.o t_zset.o zmalloc.h
anet.c cluster.c debug.c help.h lzf.h object.c rdb.c redis-cli rio.o setproctitle.o syncio.c util.c zmalloc.o
anet.h cluster.h debugmacro.h hyperloglog.c lzfP.h object.o rdb.h redis-cli.c scripting.c sha1.c syncio.o util.h
anet.o cluster.o debug.o hyperloglog.o Makefile pqsort.c rdb.o redis-cli.o scripting.o sha1.h testhelp.h util.o
[root@glon redis]#
[root@glon redis]#
[root@glon redis]# ls /usr/local/bin/
redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server
[root@glon redis]#