Redis常见的这几个问题-----不是做集群的时候!!!!

一:解决无法关闭问题
报错如下
[root@node1 6379]# /etc/init.d/redis_6379 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 ...
^C
解决办法:
[root@node1 6379]# cd /var/lib/redis/6379/
[root@node1 6379]# ps -ef |grep redis
root      12073   1653  0 20:44 pts/0    00:00:00 vi /etc/redis/6379.conf
root      12829      1  0 21:17 ?        00:00:00 /usr/local/bin/redis-server *:6379 [cluster]
root      12909  12236  0 21:21 pts/1    00:00:00 grep --color=auto redis
#####
[root@node1 6379]# kill -9 12829
[root@node1 6379]# kill -9 12073
结果:
[root@node1 6379]# /etc/init.d/redis_6379 stop
/var/run/redis_6379.pid does not exist, process is not running
######
######
二、当出现无法写入的时候
[root@node1 6379]# redis-cli -h 20.0.0.8 -p 6379
20.0.0.8:6379> set name laiss
(error) NOAUTH Authentication required.(意思是你没有权限)
解决办法(可能是你没有输入密码)
[root@node1 6379]# redis-cli -h 20.0.0.8 -p 6379
20.0.0.8:6379> suth "abc123"
(error) ERR unknown command `suth`, with args beginning with: `abc123`, 
20.0.0.8:6379> auth "abc123"    ##输入密码后就能写入
OK
#####
#####
三、这种情况是你没有启动你的服务
[root@node1 6379]# redis-cli -h 20.0.0.8 -p 6379
Could not connect to Redis at 20.0.0.8:6379: Connection refused
not connected> 
#####
四、发生了无法写入说没有槽位的问题如下
[root@node1 ~]# redis-cli -h 20.0.0.8 -p 6379
20.0.0.8:6379> set name zhangsan
(error) NOAUTH Authentication required.
20.0.0.8:6379> auth "abc123"
OK
20.0.0.8:6379> set name zhangsan
(error) CLUSTERDOWN Hash slot not served
#####
并且关的时候还无法关闭
[root@node1 ~]# /etc/init.d/redis_6379 start
/var/run/redis_6379.pid exists, process is already running or crashed
[root@node1 ~]# netstat -autp |grep 6379
tcp        0      0 node1:6379              0.0.0.0:*               LISTEN      14165/redis-server  
tcp        0      0 localhost:6379          0.0.0.0:*               LISTEN      14165/redis-server  
tcp        0      0 node1:16379             0.0.0.0:*               LISTEN      14165/redis-server  
tcp        0      0 localhost:16379         0.0.0.0:*               LISTEN      14165/redis-server 
####
#####
解决文题思路和步骤
[root@node1 ~]# cat /var/run/redis_6379.pid
cat: /var/run/redis_6379.pid: 没有那个文件或目录
[root@node1 ~]# echo "14165" >/var/run/redis_6379.pid
[root@node1 ~]# /etc/init.d/redis_6379 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 ...
####
[root@node1 ~]# pkill -9 redis            ####这是重点,重点,重点!!!!
#####
测试
[root@node1 ~]# netstat -autp |grep 6379
tcp        0      0 localhost:57924         localhost:6379          TIME_WAIT   
[root@node1 ~]# rm -rf /var/run/redis_6379.pid
[root@node1 ~]# netstat -autp |grep 6379
[root@node1 ~]# /etc/init.d/redis_6379 restart        ##正常重启
Stopping ...
Redis stopped
Starting Redis server...
#####
[root@node1 ~]# redis-cli -h 20.0.0.8 -p 6379
20.0.0.8:6379> set name kai            ##正常写入
OK
20.0.0.8:6379> quit
####
如果还是没有办法进行正常的写入的时候请去
[root@node1 ~]# vim /etc/redis/6379.conf     ##将841和833行关闭
 841 cluster-config-file nodes-6379.conf
 833 cluster-enabled yes
#####
####
正常写入了你在开启就是了

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值