zoukankan      html  css  js  c++  java
  • 编译安装redis

    本文用于描述redis的编译安装

    1、上传源码包到linux 服务器上;我已经上传到了root目录下:/root/redis-3.2.3.tar.gz

    ll /root/ | grep redis.*gz
    -rw-r--r--  1 root root    1541401 9月  17 18:37 redis-3.2.3.tar.gz

    2、解压

    tar -xzvf redis-3.2.3.tar.gz
    ll /root/ | grep redis
    drwxrwxr-x  6 root root       4096 8月   2 17:00 redis-3.2.3
    -rw-r--r--  1 root root    1541401 9月  17 18:37 redis-3.2.3.tar.gz

    3、make 这里可以直接make 是因为redis已经自己写好了make file 了;也就是说不用再执行configure 了、make 后编译好的文件会保存到src目录下

    cd /root/redis-3.2.3
    make
    ll
    总用量 196
    -rw-rw-r--  1 root root 75147 8月   2 17:00 00-RELEASENOTES
    -rw-rw-r--  1 root root    53 8月   2 17:00 BUGS
    -rw-rw-r--  1 root root  1805 8月   2 17:00 CONTRIBUTING
    -rw-rw-r--  1 root root  1487 8月   2 17:00 COPYING
    drwxrwxr-x  7 root root  4096 9月  17 18:38 deps
    -rw-rw-r--  1 root root    11 8月   2 17:00 INSTALL
    -rw-rw-r--  1 root root   151 8月   2 17:00 Makefile
    -rw-rw-r--  1 root root  4223 8月   2 17:00 MANIFESTO
    -rw-rw-r--  1 root root  6834 8月   2 17:00 README.md
    -rw-rw-r--  1 root root 46695 8月   2 17:00 redis.conf
    -rwxrwxr-x  1 root root   271 8月   2 17:00 runtest
    -rwxrwxr-x  1 root root   280 8月   2 17:00 runtest-cluster
    -rwxrwxr-x  1 root root   281 8月   2 17:00 runtest-sentinel
    -rw-rw-r--  1 root root  7109 8月   2 17:00 sentinel.conf
    drwxrwxr-x  2 root root  4096 9月  17 18:39 src
    drwxrwxr-x 10 root root  4096 8月   2 17:00 tests
    drwxrwxr-x  7 root root  4096 8月   2 17:00 utils

    4、make install 这一步会把src 目录下的二进制文件复制到/usr/local/bin/ 目录下;由于把文件保存到/usr/local/bin/目录下的方式不方便管理,于是我们把文件统一保存到

       /usr/local/redis/bin/目录下

    mkdir -p /usr/local/redis/bin/
    cd src
    cp redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server redis-trib.rb /usr/local/redis/bin/

    5、给redis提供一个启动脚本

    #!/bin/bash
    
    #chkconfig: 2345 50 50
    #description: redis-server init scripts
    
    server_exec=/usr/local/redis/bin/redis-server
    pid_file=/usr/local/redis/redis_server.pid
    port=6379
    
    case $1 in
    
    "start")
        if test -e $pid_file
        then
            echo "redisd has been started"
        else
            echo "start redisd ..."
            $server_exec --port $port --pidfile $pid_file &
        fi
    ;;
    
    "stop")
        if test -e $pid_file
        then
            echo "will to stop redisd..."
            pid=`cat $pid_file`
            kill $pid
        else
            echo "redisd has been stop"
        fi
    ;;
    
    "*")
        echo "not suport argument $1"
    ;;
    esac

    6、启动redisd

    service redisd start

    7、修改环境变量

    export PATH=/usr/local/redis/bin:$PATH
  • 相关阅读:
    DelphiXE下的字符串变化
    FastMM配置文件详解
    [转] FastMM、FastCode、FastMove的使用
    FastMM 定位内存泄露的代码位置
    转 Delphi中使用FastMM4结合View CPU避免内存泄漏
    [转] FastMM使用详解
    salesforce 零基础开发入门学习(九)Approval Process 介绍
    salesforce 零基础开发入门学习(八)数据分页简单制作
    salesforce 零基础开发入门学习(七)PickList的value值获取
    salesforce 零基础开发入门学习(六)简单的数据增删改查页面的构建
  • 原文地址:https://www.cnblogs.com/JiangLe/p/5878160.html
Copyright © 2011-2022 走看看