zoukankan      html  css  js  c++  java
  • redis安装及使用

    1.下载

    http://download.redis.io/releases/redis-2.8.12.tar.gz

    或者在我的百度云盘下载

    http://pan.baidu.com/s/1slQz0yL

    我直接下载到 /apps/softWare

    2.解压

    tar -zxvf /apps/softWare/redis-2.8.12.tar.gz -C /apps/redis/

    3.编译安装

    cd /apps/redis/redis-2.8.12/src
    
    make MALLOC=libc
    
    make test

    安装 tcl

    yum install tcl -y
    
    make test
    
    make install
    

      

    4.启动

     ./redis-server ../redis.conf 

      

    5.客户端启动测试

    启动客户端

     ./redis-cli

    添加 key为 name ,value 为 zs 的值

    set name 'zs'

    获取 key 为 name 的数据

    get name

    删除 key 为name 的数据

    del name

    退出客户端

    quit

    6.redis 常用配置修改 /apps/redis/redis-2.8.12/redis.conf

    pid

    pidfile : pidfile/var/run/redis/redis_6380.pid

    端口

    port 6380

    日志

    logfile  logfile/var/log/redis/redis_6380.log

    密码

    masterauth 6379

    7.多端口多实例启动redis

    a.创建 conf 目录 /apps/redis/redis-2.8.12/conf

    b.复制 redis.conf 到 conf目录下,2个配置

    分别配置为

    #vi redis6380.conf

    pidfile : pidfile/var/run/redis/redis_6380.pid

    port 6380

    logfile  logfile/var/log/redis/redis_6380.log

    masterauth 6380

     

    #vi redis6379.conf

    pidfile : pidfile/var/run/redis/redis_6379.pid

    port 6379

    logfile logfile/var/log/redis/redis_6379.log

    masterauth 6379

    c.启动

    ./redis-server ../conf/redis6379.conf 

    ./redis-server ../conf/redis6380.conf 

    d.查看日志

    ok,成功启动

    如果客户端无法连接,将bind的值配置为bind 0.0.0.0 

    参考命令:

    http://www.cnblogs.com/silent2012/p/5368925.html

  • 相关阅读:
    MySQL RR隔离 读一致性
    C++奥赛一本通刷题记录(高精度)
    CodeVs天梯之Diamond
    CodeVs天梯之Gold
    CodeVs天梯之Silver
    CodeVs天梯之Bronze
    【2018.1.14】本蒟蒻又回来了
    test
    UVa12545
    UVa1149
  • 原文地址:https://www.cnblogs.com/yun965861480/p/6273451.html
Copyright © 2011-2022 走看看