CentOS7.5安装Redis问题:fatal error: jemalloc/jemalloc.h: No such file or directory

cd src && make all

make[1]: Entering directory `/root/redis-4.0.14/src’

CC Makefile.dep

make[1]: Leaving directory `/root/redis-4.0.14/src’

make[1]: Entering directory `/root/redis-4.0.14/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 `/root/redis-4.0.14/src’

make: *** [all] Error 2

上面抛出 jemalloc 的原因是 jemalloc 重载了 Linux 下的 ANSI C 的 malloc 和 free 函数。解决办法:make时添加参数,如下:

make MALLOC=libc

struct redisServer’ has no member named ‘maxmemory’

  1. #升级到 5.3及以上版本
  2. yum -y install centos-release-scl
  3. yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
  4. scl enable devtoolset-9 bash
  5. #注意:scl命令启用只是临时的,推出xshell或者重启就会恢复到原来的gcc版本。
  6. #如果要长期生效的话,执行如下:
  7. echo “source /opt/rh/devtoolset-9/enable” >>/etc/profile