zoukankan      html  css  js  c++  java
  • centos 6.5 minimal 安装redis

    • 下载源码至/usr/local/
      • [root@centos local]# wget -4 http://download.redis.io/releases/redis-3.2.8.tar.gz
        • --2017-03-15 23:31:20--  http://download.redis.io/releases/redis-3.2.8.tar.gz
        • 正在解析主机 download.redis.io... 失败:域名解析暂时失败。
        • wget: 无法解析主机地址 “download.redis.io”
      • Dns有问题
        • [root@centos local]# vim /etc/resolv.conf
          • nameserver 8.8.8.8
          • nameserver 8.8.4.4
    • 解压
      • [root@centos local]# tar -zxvf redis-3.2.8.tar.gz
    • 错误:
      • make[3]: gcc:命令未找到
    • 安装gcc
      • [root@centos redis]# yum install gcc-c++
    • 错误
      • 包含自 adlist.c:34 的文件中:
      • zmalloc.h:50:31: 错误:jemalloc/jemalloc.h:没有那个文件或目录
      • zmalloc.h:55:2: 错误:#error "Newer version of jemalloc required”
      • 参考README
        • Allocator  
        • ---------  
          Selecting a non-default memory allocator when building Redis is done by setting  
          the `MALLOC` environment variable. Redis is compiled and linked against libc  
          malloc by default, with the exception of jemalloc being the default on Linux  
          systems. This default was picked because jemalloc has proven to have fewer  
          fragmentation problems than libc malloc.  
           
          To force compiling against libc malloc, use:  
           
              % make MALLOC=libc  
           
          To compile against jemalloc on Mac OS X systems, use:  
               % make MALLOC=jemalloc
        • 解决办法:
          • make MALLOC=libc
    • make
      • make MALLOC=libc
    • make test
      • [root@centos redis]# make test
    • 错误:
      • cd src && make test
      • make[1]: Entering directory `/usr/local/redis-3.2.8/src'
      • You need tcl 8.5 or newer in order to run the Redis test
      • make[1]: *** [test] 错误 1
      • make[1]: Leaving directory `/usr/local/redis-3.2.8/src'
      • make: *** [test] 错误 2
      • 原因:
        • 没有装tcl
    • 安装tcl
      • yum install -y tcl
    • make test
    • make install
    • 编译成功后将src下生成的可执行程序复制或软连接到/usr/local/bin下
      • cp redis-server /usr/local/bin/
      • cp redis-cli /usr/local/bin/
    • 新建目录存放配置文件
      • [root@centos etc]# mkdir /etc/redis
      • [root@centos etc]# cp redis.conf /etc/redis/redis-6379.conf
    • 修改配置文件:
      • daemonize yes
      • pidfile /usr/local/redis/redis_6379.pid
      • logfile /usr/local/redis/log-redis.log
    • 启动redis服务
      • [root@centos redis]# redis-server /etc/redis/redis-6379.conf
    • 客户端连接
      • [root@centos redis]# redis-cli
      • 测试:
        • 127.0.0.1:6379> PING
        • 输出:PONG
        • 表示连接成功
      • 关闭服务命令:
        • 127.0.0.1:6379> shutdown
        • not connected>
  • 相关阅读:
    javascript 之 面向对象【继承】
    javascript 之 面向对象【创建对象】
    javascript 之 函数
    EffectiveJava(26)使用泛型类替代普通类
    JAVA加解密 -- 数字签名算法
    JAVA加解密 -- 对称加密算法与非对称加密算法
    EffectiveJava(25)泛型和数组的使用取舍及规范
    EffectiveJava(24)使用@SuppressWarnings("unchecked")消除非受检警告
    EffectiveJava(23)为什么不能在新生代码中使用原生态类型
    JAVA加解密 -- 消息摘要算法
  • 原文地址:https://www.cnblogs.com/docted/p/6557540.html
Copyright © 2011-2022 走看看