环境:
redhat 7.4、redis-5.0.5、2个节点(节点一:1主+1从+1哨兵,节点二:2从+1哨兵)
1、配置启动第一个节点(1主+1从)
[root@csy3 redis-5.0.5]# yum install gcc gcc-c++ -y
......
[root@csy3 tools]# pwd
/software/tools
[root@csy3 tools]# tar -zxvf redis-5.0.5.tar.gz
[root@csy3 tools]# ls
redis-5.0.5 redis-5.0.5.tar.gz
[root@csy3 tools]# cd redis-5.0.5/
[root@csy3 redis-5.0.5]# ls
00-RELEASENOTES BUGS CONTRIBUTING COPYING deps INSTALL Makefile MANIFESTO README.md redis.conf runtest runtest-cluster runtest-moduleapi runtest-sentinel sentinel.conf src tests utils
[root@csy3 redis-5.0.5]# make
cd src && make all
make[1]: Entering directory `/software/tools/redis-5.0.5/src'
CC Makefile.dep
make[1]: Leaving directory `/software/tools/redis-5.0.5/src'
make[1]: Entering directory `/software/tools/redis-5.0.5/src'
CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory
#include <jemalloc/jemalloc.h>
compilation terminated.
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/software/tools/redis-5.0.5/src'
make: *** [all] Error 2
[root@csy3 redis-5.0.5]# cat README.md | grep -5 jemalloc #针对上面的报错在README里面有说明
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.
--
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
-------------
......
[root@csy3 redis-5.0.5]# make MALLOC=libc #如上说明,直接用README里面的
......
Hint: It's a good idea to run 'make test' ;)
make[1]: Leaving directory `/software/tools/redis-5.0.5/src'
......
[root@csy3 redis-5.0.5]# cd src/
[root@csy3 src]# ll redis-* #可以看到生成的redis-server这些直接用的命令
-rwxr-xr-x. 1 root root 354096 Aug 19 14:18 redis-benchmark
-rw-rw-r--. 1 root root 29605 May 16 00:07 redis-benchmark.c
-rw-r--r--. 1 root root 109136 Aug 19 14:18 redis-benchmark.o
-rwxr-xr-x. 1 root root 4046880 Aug 19 14:18 redis-check-aof
-rw-rw-r--. 1 root root 7175