美文网首页
redis6.0.6安装

redis6.0.6安装

作者: Aiibai | 来源:发表于2020-10-26 16:05 被阅读0次
    1. 获取资源
      wget https://download.redis.io/releases/redis-6.0.8.tar.gz
    2. 解压
      tar -zxvf redis-6.0.8.tar.gz
    3. 安装
      cd redis-6.0.8
      make
      cd src
      make install PREFIX=/usr/local/redis
    4. 移动配置文件到安装目录
      cd ../
      mkdir /usr/local/redis/etc
      mv redis.conf /usr/local/redis/etc
    5. 修改配置,支持台启动和远程连接
      daemonize yes
      protected-mode no
      bind 0.0.0.0
    6. 拷贝启动脚本至 /usr/local/bin目录
      cp /usr/local/redis/bin/redis-server /usr/local/bin
      cp /usr/local/redis/bin/redis-cli /usr/local/bin
    7. 启动
      redis-server /usr/local/redis/etc/redis.conf
    8. 启动客户端
      redis-cli
    9. 设置密码
      config set requirepass ****
    10. 停止
      pkill redis

    问题:6.x以后的版本安装时,可能会碰到如下问题
    报错server.c:xxxx:xx: error: ‘xxxxxxxx’ has no member named ‘xxxxx’

    ……
    server.c:5101:19: error: ‘struct redisServer’ has no member named ‘sofd’
             if (server.sofd > 0)
                       ^
    server.c:5102:94: error: ‘struct redisServer’ has no member named ‘unixsocket’
                 serverLog(LL_NOTICE,"The server is now ready to accept connections at %s", server.unixsocket);
                                                                                                  ^
    server.c:5103:19: error: ‘struct redisServer’ has no member named ‘supervised_mode’
             if (server.supervised_mode == SUPERVISED_SYSTEMD) {
                       ^
    server.c:5104:24: error: ‘struct redisServer’ has no member named ‘masterhost’
                 if (!server.masterhost) {
                            ^
    server.c:5117:15: error: ‘struct redisServer’ has no member named ‘maxmemory’
         if (server.maxmemory > 0 && server.maxmemory < 1024*1024) {
                   ^
    server.c:5117:39: error: ‘struct redisServer’ has no member named ‘maxmemory’
    ……
    

    原因:查看gcc的版本是否在 5.3以上,centos7默认是4.8.5.我这里的就是4.8.5
    gcc -v
    解决方案:

    yum -y install centos-release-scl
    yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
    
    scl enable devtoolset-9 bash  #scl命令启用只是临时的
    echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile  #永久生效
    

    相关文章

      网友评论

          本文标题:redis6.0.6安装

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