redis集群搭建的过程中报了一个错误:
redis cluster 搭建报错“ Sorry, can’t connect to node 192.168.8.181:7001”
这个错误主要是说连接不上,我们可以通过几步来排查:
-
- 防火墙关掉
iptables -F
# 或者
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
- 2.检查配置文件,cluster-enabled需要打开yes,protected-mode需要设置为no,bind需要绑定自己本机的地址,端口需要设置对。daemonize设置为yes。
port 7001
cluster-enabled yes
cluster-config-file /etc/redis-cluster/node-7001.conf
cluster-node-timeout 15000
daemonize yes
pidfile /var/run/redis_7001.pid
dir /var/redis/7001
logfile /var/log/redis/7001.log
bind 192.168.31.187
appendonly yes
protected-mode no
- 3.注意关掉密码认证,这个是主从的时候搞的,前面加上#,注释掉。
# requirepass foobared
#