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
  • 相关阅读:
    JS中使用正则表达式封装的一些常用的格式验证的方法-是否外部url、是否小写、邮箱格式、是否字符、是否数组
    Java中操作字符串的工具类-判空、截取、格式化、转换驼峰、转集合和list、是否包含
    Cocos2d-x 2.0 自适应多种分辨率
    应用自定义移动设备外观
    为移动设备应用程序创建外观
    【2020-11-28】人生十三信条
    【2020-11-27】事实证明,逃避是下等策略
    Python 之web动态服务器
    Python 之pygame飞机游戏
    PHP 之转换excel表格中的经纬度
  • 原文地址:https://www.cnblogs.com/JiangLe/p/5878160.html
Copyright © 2011-2022 走看看