redis-5.0.7 make编译失败fatal error: jemalloc/jemalloc.h: No such file or directory

在尝试编译Redis 5.0.7时遇到致命错误,jemalloc/jemalloc.h文件未找到。通过在make命令中指定MALLOC=libc参数成功解决了编译问题。之后,按照步骤完成了Redis的安装,包括创建bin和conf目录,移动必要文件,并启动Redis服务器。启动过程中,服务器给出了关于TCP backlog和内存设置的警告。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

redis-5.0.7 make编译失败fatal error: jemalloc/jemalloc.h: No such file or directory
[....@l..... redis-5.0.7]# make
cd src && make all
make[1]: Entering directory `/opt/redis-5.0.7/src'
    CC Makefile.dep
make[1]: Leaving directory `/opt/redis-5.0.7/src'
make[1]: Entering directory `/opt/redis-5.0.7/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

解决办法 编译时指定库

make MALLOC=libc

=================================
Redis 安装
编译成功后,进入src文件夹,执行make install进行Redis安装

cd src;make install

从src 退回上一级目录

cd ..

在redis目录创建 bin 和 conf

mkdir bin
mkdir conf

拷贝 redis.conf 配置文件

 mv redis.conf conf/

将 src 目录的 mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-server 拷贝到 redis 的 bin 目录

 mv mkreleasehdr.sh  redis-benchmark  redis-check-aof  redis-check-rdb  redis-cli  redis-sentinel  redis-server ../bin/

在redis bin 目录 执行 redis-server 就可以启动Redis 了

../redis-server ../conf/redis.conf
 ./redis-server ../conf/redis.conf 
2683:C 16 Jun 2021 11:51:33.647 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
2683:C 16 Jun 2021 11:51:33.648 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=2683, just started
2683:C 16 Jun 2021 11:51:33.648 # Configuration loaded
2683:M 16 Jun 2021 11:51:33.649 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 5.0.7 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 2683
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

2683:M 16 Jun 2021 11:51:33.651 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
2683:M 16 Jun 2021 11:51:33.651 # Server initialized
2683:M 16 Jun 2021 11:51:33.651 # 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.
2683:M 16 Jun 2021 11:51:33.651 # 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.
2683:M 16 Jun 2021 11:51:33.652 * Ready to accept connections
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值