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

    down最新的redis

    wget http://download.redis.io/releases/redis-5.0.6.tar.gz

    tar zxf redis-5.0.6.tar.gz 

    cd redis-5.0.6 && make

    mkdir -p /usr/local/redis/bin

    cp redis.conf /usr/local/redis/bin

    cp redis.conf /usr/local/bin

    cp src/redis-cli /usr/local/redis/bin

    cp src/redis-cli /usr/local/bin

    cp src/redis-server /usr/local/redis/bin

    cp src/redis-server /usr/local/bin

    cp src/redis-benchmark /usr/local/redis/bin

    cp src/redis-benchmark /usr/local/bin

    vim /usr/bin/redis

    启动文件

    #!/bin/sh
    #
    # as it does use of the /proc filesystem.

    REDISPORT=6379
    EXEC=/usr/local/bin/redis-server
    CLIEXEC=/usr/local/bin/redis-cli
    PIDFILE=/var/run/redis_${REDISPORT}.pid
    CONF="/usr/local/redis/bin/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
    ;;
    stop)
    if [ ! -f $PIDFILE ];then
    echo "$PIDFILE does not exist,process is not running"
    else
    PID=$(cat $PIDFILE)
    echo "Stopping..."
    $CLIEXEC -p $REDISPORT shutdown
    while [ -x /proc/${PID} ]
    do
    echo "Waiting for Redis to shutdown..."
    sleep 1
    done
    echo "Redis stopped"
    fi
    ;;
    restart)
    "$0" stop
    sleep 3
    "$0" start
    ;;
    *)
    echo "Please use start or stop or restart as first argument"
    ;;
    esac

    chmod 777 /usr/bin/redis  #给上面文件的权限

    配置文件

    vim /usr/local/redis/bin/redis.conf

    ---------------------------------------------

    # bind 127.0.0.1

    protected-mode no

    ---------------------------------------------

    窗口运行

     screen redis start

    ctrl+A+D跳出窗口

    kill pid可以停止服务

    或者redis stop

    或者screen -r 对应窗口终止服务

  • 相关阅读:
    HDU1172 猜数字 广搜
    HDU2688 Rotate
    HDU1006 Tick and Tick 几何
    ADO.NET中的五个主要对象
    .NET开发人员值得关注的七个开源项目
    常用正则表达式
    常用的正则表达式集锦〔转〕
    一个较优雅的GridView隐藏列取值解决方案
    DataTable分组求和
    处理[未处理的“System.StackOverflowException”类型的异常出现在 System.Windows.Fo ...
  • 原文地址:https://www.cnblogs.com/Leaders543/p/11884966.html
Copyright © 2011-2022 走看看