标签:redis服务停止报错解决方案[noauth authentication required] noauth authentication required
Redis服务器设置密码后,使用service redis stop 会出现以下信息:
[root@H28M opt]# service redis stop
Stopping ...
(error) NOAUTH Authentication required.
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
出现这样的错误信息,redis 这时是没有停止服务的。
可以使用ps -ef | grep redis 查进程号 然后kill 掉,如果在deamon下还需要去删除pid文件,有点繁琐。
解决办法:
修改redis服务脚本,加入如下所示的红色授权信息即可:
vi /etc/init.d/redis
$CLIEXEC -a "youpassword" -p $REDISPORT shutdown
或是自己添加个密码变量,直接引用如下:
vi /etc/init.d/redis #!/bin/sh # chkconfig: 2345 80 90 # # Simple Redis init.d script conceived towork on Linux systems # as it does use of the /proc filesystem. REDISPORT=6389 EXEC=/usr/local/bin/redis-server CLIEXEC=/usr/local/bin/redis-cli RESDISPASSWORD=red29 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 Redisserver..." $EXEC $CONF & fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE does notexist, process is not running" else PID=$(cat $PIDFILE) echo "Stopping ..." $CLIEXEC -a $RESDISPASSWORD -p$REDISPORT shutdown while [ -x /proc/${PID} ] do echo "Waiting forRedis to shutdown ..." sleep 1 done echo "Redis stopped" fi ;; *) echo "Please use start or stop as first argument" ;; esac
本文出自 “运维笔录 美玲” 博客,请务必保留此出处http://meiling.blog.51cto.com/6220221/1979896
Redis服务停止报错解决方案[NOAUTH Authentication required]
标签:redis服务停止报错解决方案[noauth authentication required] noauth authentication required
原文地址:http://meiling.blog.51cto.com/6220221/1979896