Linux 下编译 redis 报错解决办法

make 的时候出现以下错误:

zmalloc.o: In function `zmalloc_used_memory':
/data/redis-2.6.9/src/zmalloc.c:223: undefined reference to `__sync_add_and_fetch_4'
collect2: ld returned 1 exit status
make[1]: *** [redis-server] Error 1
make[1]: Leaving directory `/data/redis-2.6.9/src'
make: *** [all] Error 2


解决方法:

make CFLAGS="-march=i686" 


当看见“Hint: To run 'make test' is a good idea ;)” 说明编译成功。


make install


说明:其实 make install 就是:

cp -p redis-server /usr/local/bin

cp -p redis-benchmark /usr/local/bin

cp -p redis-cli /usr/local/bin

cp -p redis-check-dump /usr/local/bin

cp -p redis-check-aof /usr/local/bin

这样,redis 就安装成功了。

接下来就是启动Redis了, 上面编译后生成的那些可执行文件拷贝到了/usr/local/bin目录下面, 他们的作用分别是:

redis-server:Redis服务器的daemon启动程序

redis-cli:Redis命令行操作工具。当然,你也可以用 telnet 根据其纯文本协议来操作

redis-benchmark:Redis性能测试工具,测试Redis在你的系统及你的配置下的读写性能

启动 Redis 进程只需要执行这个 /usr/local/bin/redis-server /path-to/redis.conf

启动的时候后面要跟上 redis 的配置文件, 这样Redis就顺利启动了.

3、启动 redis 会出现的问题

Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.

解决方法:修改配置文件 redis.conf  将 maxmemory 设置为 maxmemory 1024000000 #分配256M内存

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.

解决方法:警告:过量使用内存设置为0!在低内存环境下,后台保存可能失败。为了修正这个问题,请在/etc/sysctl.conf 添加一项 'vm.overcommit_memory = 1' ,然后重启(或者运行命令'sysctl vm.overcommit_memory=1' )使其生效。

当启动的时候没有任何信息,表明启动成功。也可以使用 "netstat -tnl" 查看6379端口是否启动。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值