-
启动
-
查看redis.conf文件,可以通过general中的说明,配置通过systemd来启停 redis 和查看redis状态(作者没有采用,而是使用service管理,service配置参考《02. Instal redis on Linux》)
-
这里直接说通过service启动命令: service redis_server start #这里redis_server名称依据配置service是的init脚本名;配置文件使用路径查看redis_server脚本。
-
其它启动方式:也可以编辑启动脚本来启动redis
-
编辑启动脚本
shell>vi start-redis.sh #!/bin/bash source /etc/profile REDIS_HOME=/ghca/redis-3.2.6 $REDIS_HOME/bin/redis-server $REDIS_HOME/etc/redis.conf
-
直接使用服务可执行程序和配置文件路径 来启动redis
shell>$REDIS_HOME/bin/redis-server redis.conf #即可,不过可以在启动命令总添加参数
-
停止
-
呼应启动第一条
-
service redis_server stop
-
直接kill 进程号 (kill -15 PID)
-
使用redis-cli客户端
shell>redis -h host/ip -p port SHUTDOWN 向redis-server端发送SHUTDOWN命令
-
其提供脚本参考:自己写的启停redis-server脚本
#!/bin/sh
REDISPORT=6666
EXEC=./redis-server
CLIEXEC=./redis-cli
AUTHPASSWD='Passwd_By_Zjq;' # 如果设置了密码,这里是需要设置的,因为利用redis-cli 发送shutdown信号需要提供密码。
PIDFILE=/ghca/redis/bin/redis_${REDISPORT}.pid
CONF="/ghca/redis/etc/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 -a $AUTHPASSWD -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
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- 服务端指南 服务端概述 | 微服务架构概述
- 微服务化之服务拆分与服务发现
- 微服务化之服务拆分与服务发现
- 小白入门微服务(4) - 服务注册与服务发现
- 服务端指南 服务端概述 | SOA 对比微服务架构
- MySQL服务启动时显示本地计算机上的MySQL服务启动后停止。某些服务在未由其它服务或。。。
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Coding the Matrix
Philip N. Klein / Newtonian Press / 2013-7-26 / $35.00
An engaging introduction to vectors and matrices and the algorithms that operate on them, intended for the student who knows how to program. Mathematical concepts and computational problems are motiva......一起来看看 《Coding the Matrix》 这本书的介绍吧!