zoukankan      html  css  js  c++  java
  • 第一节 Redis的安装配置


    下载:wget http://download.redis.io/releases/redis-3.2.8.tar.gz
    解压:tar -zxvf redis-3.2.8.tar.gz
    进入到:/usr/local/redis make
    进行测试:make test
      报错如下:

        /bin/sh: cc: command not found
        make[1]: *** [adlist.o] Error 127
        make[1]: Leaving directory `/usr/local/redis/src'
        make: *** [all] Error 2

      这是由于CentOS系统没有装gcc

      解决办法:
      (1)使用yum安装gcc :yum install  gcc
      (2)清空上次编译失败的残留文件(这个很重要,不然会一直安装失败):make distclean
      (3)接下来继续安装redis:  make 然后make install

    然后继续 make 

      报错如下
        make[1]: Entering directory '/usr/local/redis/src'
        You need tcl 8.5 or newer in order to run the Redis test
        Makefile:225: recipe for target 'test' failed
        make[1]: *** [test] Error 1
        make[1]: Leaving directory '/usr/local/redis/src'
        Makefile:6: recipe for target 'test' failed
        make: *** [test] Error 2

      解决方法:
      wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz 
      tar xzvf tcl8.6.1-src.tar.gz -C /usr/local/ 
      cd /usr/local/tcl8.6.1/unix/ 
      ./configure



    回到 /usr/local/redis:make install

    Redis已经安装到 /usr/local/bin
      -rwxr-xr-x 1 root root 5738696 Mar 4 03:58 redis-server* Redis服务器
      -rwxr-xr-x 1 root root 2967904 Mar 4 03:58 redis-cli* Redis命令行客户端
      -rwxr-xr-x 1 root root 2773112 Mar 4 03:58 redis-benchmark* Redis性能测试工具
      -rwxr-xr-x 1 root root 29032 Mar 4 03:58 redis-check-aof* AOF文件修复工具
      -rwxr-xr-x 1 root root 5738696 Mar 4 03:58 redis-check-rdb* RDB文件检索工具


    修改配置文件,移动到/etc/目录下,配置文件目录为 /usr/local/redis/redis.conf /etc/redis/
      进入目录:root@ubantu:/usr/local/redis#
      执行:cp redis.conf /etc/redis/redis.conf

      vi /etc/redis/redis.conf
      修改:
      daemonize yes 守护进程运行
      dir /var/lib/redis 数据文件存储路径,Redis目录不存在得先新建
      logfile /var/log/redis/redis-server.log 日志文件,Redis目录不存在得先新建

    启动服务端:
      redis-server /etc/redis/redis-server.conf
    查看是否启动:
      ps aux | grep redis
      返回如下表示已启动,32625即进程id
      root 32625 0.0 0.7 133540 7528 ? Ssl 03:29 0:00 redis-server 127.0.0.1:6379
    关闭:
      kill -9 进程id

    客户端连接Redis,默认连接到0号数据库,Redis有16个数据库,通过0-15表示
      redis-cli
      测试是否连接成功:ping
      返回 PONG 表示成功

      切换到4号数据库
      select 4

  • 相关阅读:
    2015抢票记事
    Provide your license server administrator with the following information.error code =-42,147
    微信支付现金红包接口
    SQL Server 触发器
    SQL增删查改注意的事项
    SQL while循环
    SQL SERVER 中is null 和 is not null 将会导致索引失效吗?
    HTML中head里的内容经浏览器解析后全到body里了
    sqLSERVER 计划缓存
    通用分页存储过程
  • 原文地址:https://www.cnblogs.com/kogmaw/p/12411513.html
Copyright © 2011-2022 走看看