美文网首页
centos7下源码安装Redis

centos7下源码安装Redis

作者: 00天火00 | 来源:发表于2017-04-27 15:44 被阅读0次

    我的博客

    说明

    Redis官网:https://redis.io
    本文章使用版本:redis-3.2.8.tar.gz
    下载地址:http://download.redis.io/releases/redis-3.2.8.tar.gz

    Redis安装

    1. 下载
    sudo wget http://download.redis.io/releases/redis-3.2.8.tar.gz
    
    2. 安装
    sudo tar -zxvf redis-3.2.8.tar.gz
    cd redis-3.2.8/
    sudo make
    sudo make install
    
    3. 配置

    开启相关防火墙

    firewall-cmd --zone=public --add-port=6379/tcp --permanent 
    systemctl restart firewalld.service
    

    服务配置

    cd utils/
    ./install_server.sh
    

    上图1为配置文件地址。

    上图2为日志文件地址。

    上图3为数据文件地址。

    上图4为启动文件地址。

    Redis基础配置(其他机器访问,密码,持久化)传送门:http://www.thuol.com/index/article/getcontent/id/0b7851e3ab98c9b5cfa5b582ef109bee.html

    4. 启动

    创建redis.service

    vi /lib/systemd/system/redis.service
    

    写入以下内容

    [Unit]
    Description=Redis
    [Service]
    Type=forking
    ExecStart=/etc/init.d/redis_6379 start
    ExecStop=/etc/init.d/redis_6379 stop
    [Install]
    

    第一次使用/etc/init.d/redis_6379 start启动

    /etc/init.d/redis_6379 start    #启动Redis
    /etc/init.d/redis_6379 stop     #关闭Redis
    

    之后使用命令

    systemctl start redis.service              #启动redis服务
    systemctl enable redis.service             #设置开机自启动
    systemctl disable redis.service            #停止开机自启动
    systemctl status redis.service             #查看服务当前状态
    
    5. 测试

    进入客户端

    redis-cli
    

    相关文章

      网友评论

          本文标题:centos7下源码安装Redis

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