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

  • 相关阅读:
    windows xp查看缩略图时有缩略图没有文件名
    数据库的相关操作
    使用timer控件创建一个简单的报警程序
    xp_sendmail的正确配置与使用
    SQL Server 索引结构及其使用(三)
    启动与关闭服务器
    不间断连续图片滚动效果的制作方法
    使用C#调用外部Ping命令获取网络连接情况
    SQL Server 索引结构及其使用(一)
    winform 与asp.net 下拉列表的区别
  • 原文地址:https://www.cnblogs.com/scarecrowpqs/p/5799365.html
Copyright © 2011-2022 走看看