一:解决无法关闭问题
报错如下
[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
#####
####
正常写入了你在开启就是了
Redis常见的这几个问题-----不是做集群的时候!!!!
最新推荐文章于 2024-04-11 11:21:55 发布