欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Linux下Redis設(shè)置密碼及開(kāi)機(jī)自啟動(dòng)

 更新時(shí)間:2016年12月20日 10:21:05   作者:上天入地  
這篇文章主要介紹了Linux下Redis設(shè)置密碼及開(kāi)機(jī)自啟動(dòng)的相關(guān)資料,需要的朋友可以參考下

1、設(shè)置Redis.conf中daemonize為yes,確保守護(hù)進(jìn)程開(kāi)啟;

     找到#requirepass foorbared這一行,直接替換掉這行,改為requirepass 新密碼

2、編寫開(kāi)機(jī)自啟動(dòng)腳本

vi /etc/init.d/redis

腳本內(nèi)容如下:

#!/bin/sh
#chkconfig: 2345 80 90
# Simple Redis init.d script conceived to work on Linux systems
# 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="/etc/redis/${REDISPORT}.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
    ;;
  *)
    echo "Please use start or stop as first argument"
    ;;
esac

3、寫完后保存退出

4、設(shè)置權(quán)限

chmod 755 redis

5、啟動(dòng)測(cè)試

/etc/init.d/redis start

6、連接測(cè)試

redis-cli -a 新密碼 -p 6379

7、設(shè)置開(kāi)機(jī)自啟動(dòng)

chkconfig redis on

以上所述是小編給大家介紹的Linux下Redis設(shè)置密碼及開(kāi)機(jī)自啟動(dòng),希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論