redis学习(一):linux安装redis

来源:互联网 发布:淘宝模板页头 编辑:程序博客网 时间:2024/04/30 01:20

linux系统安装redis,我们先看redis官网上给的:


以上便是redis官网给的安装步骤,很简单,之所以这么简单是建立在你的linux系统配置完全没有问题,然而一个干净的linux好像并没有配置。

当你的linux系统没有配置好的情况下

1.当你执行make的时候,有可能报下面的错误

gcc :命令为找到
/bin/sh :cc : command not found

解决方法:

在linux联网的情况下,root权限执行命令:yum install gcc

如果你的yum 被占用,可以执行命令 : 

rm -f /var/run/yum.pid

2.当你再次执行make这条命令的时候 ,还有可能报下面的错误:

zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目录

解决方法:

执行命令:make MALLOC=libc

3.当你执行到src/redis-server 时,有可能报下面的错误

1)The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set tothe lower value of 128

2)WARNING overcommit_memory is set to 0! Background save may fail under low memorycondition. To fix this issue add ‘vm.overcommit_memory = 1‘ to /etc/sysctl.conf and then reboot or runthe command ‘sysctl vm.overcommit_memory=1‘ for this to take effect.

解决:修改/etc/sysctl.conf文件,在文件末尾加入以下两句:

net.core.somaxconn= 1024
vm.overcommit_memory = 1

3)WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This willcreate 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 toretain the setting after a reboot. Redis must be restarted after THP is disabled.

临时解决:root用户执行echo never > /sys/kernel/mm/transparent_hugepage/enabled

永久解决:将上面这句话写入到/etc/rc.local文件中。

重启redis

4)启动server时最好加上redis的配置文件,启动命令 : src/redis-server redis.conf 

这样基本上可以启动成功了,测试一下,ok










原创粉丝点击