redis sentinel 故障

同事把sentinel monistor mymaster 的ip给改了,造成无法获取sentinel错误.

PHP Redis客户端报错如下:

PSRedis\Exception\ConnectionError: All sentinels are unreachable in /home/xxxx/vendor/jamescauwelier/psredis/lib/PSRedis/MasterDiscovery.php:153

用netstat检查端口情况
sudo netstat -tulpn
返回

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:26379 0.0.0.0:* LISTEN 1857/redis-sentinel
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 1025/redis-server 1
tcp 0 0 0.0.0.0:58543 0.0.0.0:* LISTEN 728/rpc.statd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 689/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1310/sshd
tcp6 0 0 :::8025 :::* LISTEN 978/mailhog
tcp6 0 0 :::443 :::* LISTEN 1106/apache2
tcp6 0 0 :::1025 :::* LISTEN 978/mailhog
tcp6 0 0 :::26379 :::* LISTEN 1857/redis-sentinel
tcp6 0 0 :::111 :::* LISTEN 689/rpcbind
tcp6 0 0 :::80 :::* LISTEN 1106/apache2
tcp6 0 0 :::53301 :::* LISTEN 728/rpc.statd
tcp6 0 0 :::22 :::* LISTEN 1310/sshd
udp 0 0 0.0.0.0:8869 0.0.0.0:* 583/dhclient
udp 0 0 0.0.0.0:56035 0.0.0.0:* 728/rpc.statd
udp 0 0 0.0.0.0:851 0.0.0.0:* 689/rpcbind
udp 0 0 127.0.0.1:904 0.0.0.0:* 728/rpc.statd
udp 0 0 0.0.0.0:68 0.0.0.0:* 583/dhclient
udp 0 0 0.0.0.0:111 0.0.0.0:* 689/rpcbind
udp6 0 0 :::43606 :::* 583/dhclient
udp6 0 0 :::851 :::* 689/rpcbind
udp6 0 0 :::60366 :::* 728/rpc.statd
udp6 0 0 :::111 :::* 689/rpcbind

原因是把sentiel ip从127.0.0.1 改为某个192的ip了. 改回来后,重启sentinel服务.问题解决.

sudo service redis-sentinel restart