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>
  • 相关阅读:
    electrica writeup
    C++ Tips and Tricks
    net-force.nl/steganography writeup
    3*n/2
    C++ 关键字浅谈
    MindMaster激活教程
    gitignre
    python pil 安装
    ubuntu 阿里云安全配置
    阿里云 centos 环境配置与 django 部署
  • 原文地址:https://www.cnblogs.com/docted/p/6557540.html
Copyright © 2011-2022 走看看