zoukankan      html  css  js  c++  java
  • Centos7 安装redis3.2.3 过程

    1:安装wget: yum install wget
    2:安装pip:
        1:sudo yum -y install epel-release
        2:sudo yum -y install python-pip
    3:安装redis:
        1:wget --no-check-certificate http://download.redis.io/releases/redis-3.2.3.tar.gz
        2:tar xzf redis-3.2.3.tar.gz
        3:mv redis-3.2.3 usr/local/redis-3.2.3
        4:cd usr/loacl/redis-3.2.3
        5:make
        6:设置开机自启:
            1:设置redis.conf中daemonize为yes
            2:设置redis.conf中logfile为"/var/log/redis.log"
            2:编写开机自启动脚本
                vi /etc/init.d/redis
                redis content is:
    """


    # chkconfig: 2345 10 90  
    # description: Start and Stop redis   
     
    PATH=/usr/local/bin:/sbin:/usr/bin:/bin
    REDISPORT=6379
    EXEC=/usr/local/redis-3.2.3/src/redis-server
    REDIS_CLI=/usr/local/redis-3.2.3/src/redis-cli

    PIDFILE=/var/run/redis.pid
    CONF="/usr/local/redis-3.2.3/redis.conf"

    case "$1" in   
            start)   
                    if [ -f $PIDFILE ]   
                    then   
                            echo "$PIDFILE exists, process is already running or crashed."  
                    else  
                            echo "Starting Redis server..."  
                            $EXEC $CONF   
                    fi   
                    if [ "$?"="0" ]   
                    then   
                            echo "Redis is running..."  
                    fi   
                    ;;   
            stop)   
                    if [ ! -f $PIDFILE ]   
                    then   
                            echo "$PIDFILE exists, process is not running."  
                    else  
                            PID=$(cat $PIDFILE)   
                            echo "Stopping..."  
                           $REDIS_CLI -p $REDISPORT  SHUTDOWN    
                            sleep 2  
                           while [ -x $PIDFILE ]   
                           do  
                                    echo "Waiting for Redis to shutdown..."  
                                   sleep 1  
                            done   
                            echo "Redis stopped"  
                    fi   
                    ;;   
            restart|force-reload)   
                    ${0} stop   
                    ${0} start   
                    ;;   
            *)   
                   echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload}" >&2  
                    exit 1  
    esac

    """

            4:chmod +x /etc/init.d/redis
            5:/etc/init.d/redis start
            6:设置开机自启:sudo chkconfig redis on

  • 相关阅读:
    GridView实用示例源码附加导出Excel功能
    在做web项目时经常遇到新闻要上一篇,下一篇
    wpf是什么
    今天发的一些文章是早以前遇到一些小问题,园友别炮轰我哦
    Excel表中的数据导入到数据库中
    WPF指南之XAML概述
    sql 替换字段内的内容及出现的问题
    const 和readonly
    SQL2008报Script failed for Server 'xxxxxx.database.windows.net' (Microsoft.SqlServer.Smo)这样的错误
    新年新气象
  • 原文地址:https://www.cnblogs.com/scarecrowpqs/p/5799365.html
Copyright © 2011-2022 走看看