[root@localhost init.d]# /etc/init.d/redis_6379 stop
Stopping ...
Could not connect to Redis at 127.0.0.1:6379: Connection refused
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启用安全认证,requirepass该配置后,对应也要修改启动和关闭的脚本,在脚本关闭处指定IP和密码参数:-h 192.168.131.10 -a password
修改: 修改/etc/init.d/redis_6379文件的第43行。指定主机IP和密码参数
[root@localhost~]# cd /etc/init.d/[root@localhost init.d]# ls
functions netconsole network README redis_6379
[root@localhost init.d]# vim redis_6379
43 $CLIEXEC -h 192.168.131.10-p $REDISPORT -a hadoop shutdown
[root@localhost init.d]# /etc/init.d/redis_6379 stop
Stopping ...
Warning: Using a password with '-a' or '-u' option on the command line interfacemay not be safe.
Waiting for Redis to shutdown ...
Redis stopped
[root@localhost init.d]# /etc/init.d/redis_6379 start
Starting Redis server...[root@localhost init.d]# /etc/init.d/redis_6379 status
Redis is running (1813)
或者直接将密码设置为空
[root@localhost~]# /etc/init.d/redis_6379 restart
Stopping ...
Warning: Using a password with '-a' or '-u' option on the command line interfacemay not be safe.(error) NOAUTH Authentication required.
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...[root@localhost~]# redis-cli -h 192.168.131.10-p 6379192.168.131.10:6379> auth 5514
OK
192.168.131.10:6379> CONFIG SET requirepass ''
OK
[root@localhost~]# /etc/init.d/redis_6379 restart
Stopping ...
Warning: Using a password with '-a' or '-u' option on the command line interfacemay not be safe.
Waiting for Redis to shutdown ...
Redis stopped
Starting Redis server...