当前位置: 首页>供应信息>正文

Linux中如何设置Redis开机启动_dxb.120ask.com

    发布日期:2018-4-18    来源: 机械设备网   编辑:笔名
核心提示:Linux中如何设置Redis开机启动

Linux中如何设置Redis开机启动

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

假设Redis已经安装,版本3.2.4

#cd redis-3.2.4

#mkdir /etc/redis

#cp nf /etc/redis/nf

#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

CO儿童癫痫原因NF=/etc/redis/${REDISPORT}.conf

case &q河南女性癫痫病uot;$1 in

start)

if [ -f $PIDFILE ]

t小儿癫痫的诊治hen

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 $RED癫痫病的治愈价格多少ISPORT shutdown

while [ -x /proc/${PID} ]

do

e北京哪所医院治疗癫痫最好cho 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 nf /etc/redis/nf

#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/redi郑州医院癫痫哪家好s-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, proc治疗癫痫病用什么方法ess 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 forutdown ...

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/nf



 
相关阅读
 
热门图文
推荐资讯
推荐资讯
 
 
   
癫痫病   怎么治疗癫痫病   治疗癫痫   海口癫痫医院   引起儿童癫痫的病因   癫痫病发作怎么处理   昆明治疗癫痫病的医院   昆明治疗癫痫病的医院   沈阳儿童癫痫病医院   沈阳儿童癫痫病医院   北京军海治癫痫怎么样   北京军海治癫痫怎么样   治疗癫痫最好的医院  
 
网站首页 | 行业动态| 企业新闻| 市场分析| 机械技术| 综合新闻| 求购信息| 供应信息| 产品信息| 原材料行情| 产品采购| 机械市场| 机械应用| 网站地图