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

    yum install gcc-c++
     
    tar -zxvf redis-4.0.10.tar.gz
    cd redis-4.0.10
    make
    make PREFIX=/usr/local/redis install
     
    echo "export PATH=$PATH:/usr/local/redis/bin">>/etc/profile 
    source /etc/profile
     
    cp redis.conf /etc/redis_6379.conf
     

    /etc/redis_6379.conf 文件配置
    port 6379
    daemonize yes
    dir "/data/redis/6379/"
    logfile "6379.log"
    dbfilename "dump-6379.rdb"

    启动redis

    redis-server /etc/redis_6379.conf &

    或者使用 /etc/init.d 的方式,创建下面文件

    vi /etc/init.d/redis_6379

    #/bin/sh
    #Configurations injected by install_server below....

    EXEC=/usr/local/redis/bin/redis-server
    CLIEXEC=/usr/local/redis/bin/redis-cli
    PIDFILE=/var/run/redis_6379.pid
    CONF="/etc/redis_6379.conf"
    REDISPORT="6379"
    #password="chengce243"
     

    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
            ;;
        stop)
            if [ ! -f $PIDFILE ]
            then
                echo "$PIDFILE does not exist, process is not running"
            else
                PID=$(cat $PIDFILE)
                echo "Stopping ..."
                $CLIEXEC -a $password -p $REDISPORT shutdown
                while [ -x /proc/${PID} ]
                do
                    echo "Waiting for Redis to shutdown ..."
                    sleep 1
                done
                echo "Redis stopped"
            fi
            ;;
        status)
            if [ ! -f $PIDFILE ]
            then
                echo 'Redis is not running'
            else
                echo "Redis is running ($(<$PIDFILE))"
            fi
            ;;
        restart)
            $0 stop
            $0 start
            ;;
        *)
            echo "Please use start, stop, restart or status as first argument"
            ;;
    esac

    关闭redis

    redis-cli -p 6379 shutdown

    或者

    /etc/init.d/redis_6379 stop

     
  • 相关阅读:
    Python 元胞自动机模拟——生命游戏
    ()python画动态图——plt.ion动图使用,训练过程展示
    Python——因子分析(KMO检验和Bartlett's球形检验)
    bind(),unbind(),hover(),toggle(),animate()
    多计算机通信中的时间同步问题
    如何创建自定义尺寸的空白地图
    ROS中的珊格地图——nav_msgs::OccupancyGrid
    c++使用eigen库,矩阵维度错误
    Eigen 求最小二乘
    Mybatis 框架下 SQL 注入攻击的 3 种方式,真是防不胜防!
  • 原文地址:https://www.cnblogs.com/liang545621/p/9410381.html
Copyright © 2011-2022 走看看