饿虎岗资源网 Design By www.oxmxm.com

一、CentOS 7.0系统下的设置方法

假设Redis已经安装,版本3.2.4

#cd redis-3.2.4

#mkdir /etc/redis

#cp redis.conf /etc/redis/6379.conf

#cp utils/redis_init_script /etc/init.d/redis

#chmod a+x /etc/init.d/redis

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

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

#vim /etc/init.d/redis

在脚本文件添加 #chkconfig: 2345 80 90

否则会出现 “redis服务不支持chkconfig”的错误提示

#!/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

注册事件,开机启动

#chkconfig redis on

启动服务

#service redis start

查看服务是否启动

#lsof -i:6379

二、Debian 8.0设置方法

步骤与上面类似,不过Debian 用update-rc.d (或insserv)代替chkconfig

脚本文件描述也不一样。

假设Redis已经安装,版本3.2.4

#cd redis-3.2.4

#mkdir /etc/redis

#cp redis.conf /etc/redis/6379.conf

#cp utils/redis_init_script /etc/init.d/redis

#chmod a+x /etc/init.d/redis

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

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

#vim /etc/init.d/redis

在脚本文件添加

### BEGIN INIT INFO
# Provides:   redis6379
# Required-Start: $local_fs $network
# Required-Stop:  $local_fs
# Default-Start:  2 3 4 5
# Default-Stop:  0 1 6
# Short-Description: redis6379
# Description:  penavico redis 6379
### END INIT INFO

否则会出现 “ insserv: warning: script ‘redis6379′ missing LSB tags and overrides”的错误提示

#!/bin/sh
#
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
### BEGIN INIT INFO
# Provides:   redis6379
# Required-Start: $local_fs $network
# Required-Stop:  $local_fs
# Default-Start:  2 3 4 5
# Default-Stop:  0 1 6
# Short-Description: redis6379
# Description:  penavico redis 6379
### END INIT INFO

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

注册事件,开机启动

#update-rc.d redisd defaults

启动服务

#service redis start

查看服务是否启动

#lsof -i:6379

开机启动以后,默认的配置文件位置:/etc/redis/6379.conf

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对的支持。

饿虎岗资源网 Design By www.oxmxm.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
饿虎岗资源网 Design By www.oxmxm.com

稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!

昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。

这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。

而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?