美文网首页
redis安装.md

redis安装.md

作者: linlinlinxllin | 来源:发表于2018-06-02 15:01 被阅读17次

    redis安装以及安装遇到的错误

    1.下载安装

    下载安装包

    wget http://download.redis.io/releases/redis-4.0.9.tar.gz
    

    解压到指定文件夹

    tar zxvf redis-4.0.9.tar.gz -C /soft
    

    重命名

    mv redis-4.0.9 redis
    

    编译

    make
    

    编译成功之后,进入src文件下,执行make install

    make install
    

    2.部署

    创建bin和etc文件夹

    mkdir -p /soft/redis/bin
    
    mkdir -p /soft/redis/etc
    

    将src下的文件移动到bin下

    mv mkreleasedhdr.sh redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-server /soft/redis/bin
    
    ll.png

    将redis下的redis.conf移动到etc下

    mv /soft/redis/redis.conf /soft/redis/etc
    

    编辑redis.conf 文件,将daemonize属性改为yes

    配置全局变量

    vi /etc/profile
    
    export PATH=/soft/redis/bin$:PATH --->添加该代码
    
    source /etc/profile --->执行
    

    执行redis-server命令,启动redis

    redis-server
    

    3.错误解决

    1. 第一个警告:

    The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

    意思是:TCP backlog设置值,511没有成功,因为 /proc/sys/net/core/somaxconn这个设置的是更小的128在/etc/sysctl.conf中添加如下

        net.core.somaxconn = 2048
    
    1. 第二个警告:

    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.

    在/etc/sysctl.conf中添加如下

        vm.overcommit_memory = 1
    
    1. 第三个警告:

    you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix thisissue 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 thesetting after a reboot. Redis must be restarted after THP is disabled.

    意思是:你使用的是透明大页,可能导致redis延迟和内存使用问题。

        cd /etc/default
    
        vi grub
    

    在GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 console=tty0 console=ttyS0,115200n8"中添加transparent_hugepage=never


    ll2.png

    再执行命令

        grub2-mkconfig -o /boot/grub2/grub.cfg
    

    重启

        init 6
    

    参考网站:https://www.linuxidc.com/Linux/2018-05/152459.htm
    https://www.cnblogs.com/zhaoyan001/p/6143170.html

    相关文章

      网友评论

          本文标题:redis安装.md

          本文链接:https://www.haomeiwen.com/subject/uqsrsftx.html