美文网首页
2.Redis安装

2.Redis安装

作者: xMustang | 来源:发表于2020-02-23 15:31 被阅读0次

    Redis安装

    1. 安装

    1.1 编译安装

    wget http://download.redis.io/releases/redis-3.2.12.tar.gz
    tar -zvxf redis-3.2.12.tar.gz
    // 安装gcc
    yum install gcc
    // 编译
    cd redis-3.2.12
    make
    // 服务端启动Redis
    ./src/redis-server redis.conf
    // 客户端连接
    ./src/redis-cli
    ./src/redis-cli -h 172.23.23.230 -p 6379
    
    // 安装
    make PREFIX=/usr/local/redis/ install
    cp redis.conf /usr/local/redis/bin/
    // 启动 redis-server redis.conf
    

    1.2 修改配置文件

    bind 127.0.0.1          //绑定ip,不绑定则注销掉即可
    protected-mode yes
    port 6379               //修改端口
    daemonize yes           //是否后台启动
    databases 16            //数据库数
    save 900 1              //SNAPSHOTTING参数
    save 300 10
    save 60 10000
    requirepass foobared    //密码设置
    requirepass 123456      // 设置密码为123456
    appendonly no           //是否开启aof
    

    1.3 报错解决

    # You need tcl 8.5 or newer in order to run the Redis test
    yum install tcl
    

    2. 使用

    2.1 设置密码后连接

    redis-cli -h 172.23.23.230 -p 6379 -a 123456
    
    或者
    redis-cli -h 172.23.23.230 -p 6379
    auth 123456
    

    2.2 性能测试

    ./src/redis-benchmark -h 172.23.23.230 -p 6379 -q
    

    相关文章

      网友评论

          本文标题:2.Redis安装

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