简单说 所有配置完成,启动 sentinel 20s后日志报错 连接不到slave
4858:X 03 Jan 22:44:33.507 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
4858:X 03 Jan 22:44:33.519 # Sentinel ID is 0a23a81d31a84d60e33ecd4efb81bdb41aec1c99
4858:X 03 Jan 22:44:33.520 # +monitor master myredis_6379 127.0.0.1 6379 quorum 2
4858:X 03 Jan 22:44:33.520 # +monitor master myredis_6381 127.0.0.1 6381 quorum 2
4858:X 03 Jan 22:44:33.520 # +monitor master myredis_6380 127.0.0.1 6380 quorum 2
4858:X 03 Jan 22:44:33.521 * +slave slave 192.168.253.107:6379 192.168.253.107 6379 @ myredis_6379 127.0.0.1 6379
4858:X 03 Jan 22:44:33.532 * +slave slave 192.168.253.107:6381 192.168.253.107 6381 @ myredis_6381 127.0.0.1 6381
4858:X 03 Jan 22:44:33.543 * +slave slave 192.168.253.107:6380 192.168.253.107 6380 @ myredis_6380 127.0.0.1 6380
4858:X 03 Jan 22:45:03.542 # +sdown slave 192.168.253.107:6379 192.168.253.107 6379 @ myredis_6379 127.0.0.1 6379
4858:X 03 Jan 22:45:03.542 # +sdown slave 192.168.253.107:6381 192.168.253.107 6381 @ myredis_6381 127.0.0.1 6381
4858:X 03 Jan 22:45:03.626 # +sdown slave 192.168.253.107:6380 192.168.253.107 6380 @ myredis_6380 127.0.0.1 6380
怎么测都是可以联通的,slave也是正常运行的 开debug吧 没辙 配置添加
loglevel debug
看日志.....
11465:X 03 Jan 23:41:47.136 # Sentinel ID is 55cc5ea18790f071c249a09c1a2f4c8935db045d
11465:X 03 Jan 23:41:47.137 # +monitor master myredis_6379 192.168.253.7 6379 quorum 2
11465:X 03 Jan 23:41:47.137 # +monitor master myredis_6380 192.168.253.7 6380 quorum 2
11465:X 03 Jan 23:41:47.137 # +monitor master myredis_6381 192.168.253.7 6381 quorum 2
11465:X 03 Jan 23:41:47.137 . -cmd-link-reconnection slave 192.168.253.107:6379 192.168.253.107 6379 @ myredis_6379 192.168.253.7 6379 #Invalid argument
11465:X 03 Jan 23:41:47.137 . -pubsub-link-reconnection slave 192.168.253.107:6379 192.168.253.107 6379 @ myredis_6379 192.168.253.7 6379 #Invalid argument
11465:X 03 Jan 23:41:47.138 . -cmd-link-reconnection slave 192.168.253.107:6380 192.168.253.107 6380 @ myredis_6380 192.168.253.7 6380 #Invalid argument
11465:X 03 Jan 23:41:47.138 . -pubsub-link-reconnection slave 192.168.253.107:6380 192.168.253.107 6380 @ myredis_6380 192.168.253.7 6380 #Invalid argument
11465:X 03 Jan 23:41:47.138 . -cmd-link-reconnection slave 192.168.253.107:6381 192.168.253.107 6381 @ myredis_6381 192.168.253.7 6381 #Invalid argument
11465:X 03 Jan 23:41:47.138 . -pubsub-link-reconnection slave 192.168.253.107:6381 192.168.253.107 6381 @ myredis_6381 192.168.253.7 6381 #Invalid argument
11465:X 03 Jan 23:41:48.177 . -cmd-link-reconnection slave 192.168.253.107:6379 192.168.253.107 6379 @ myredis_6379 192.168.253.7 6379 #Invalid argument
11465:X 03 Jan 23:41:48.178 . -pubsub-link-reconnection slave 192.168.253.107:6379 192.168.253.107 6379 @ myredis_6379 192.168.253.7 6379 #Invalid argument
11465:X 03 Jan 23:41:48.178 . -cmd-link-reconnection slave 192.168.253.107:6380 192.168.253.107 6380 @ myredis_6380 192.168.253.7 6380 #Invalid argument
11465:X 03 Jan 23:41:48.178 . -pubsub-link-reconnection slave 192.168.253.107:6380 192.168.253.107 6380 @ myredis_6380 192.168.253.7 6380 #Invalid argument
11465:X 03 Jan 23:41:48.178 . -cmd-link-reconnection slave 192.168.253.107:6381 192.168.253.107 6381 @ myredis_6381 192.168.253.7 6381 #Invalid argument
11465:X 03 Jan 23:41:48.178 . -pubsub-link-reconnection slave 192.168.253.107:6381 192.168.253.107 6381 @ myredis_6381 192.168.253.7 6381 #Invalid argument
11465:X 03 Jan 23:41:49.215 . -cmd-link-reconnection slave 192.168.253.107:6379 192.168.253.107 6379 @ myredis_6379 192.168.253.7 6379 #Invalid argument
11465:X 03 Jan 23:41:49.215 . -pubsub-link-reconnection slave 192.168.253.107:6379 192.168.253.107 6379 @ myredis_6379 192.168.253.7 6379 #Invalid argument
11465:X 03 Jan 23:41:49.215 . -cmd-link-reconnection slave 192.168.253.107:6380 192.168.253.107 6380 @ myredis_6380 192.168.253.7 6380 #Invalid argument
11465:X 03 Jan 23:41:49.215 . -pubsub-link-reconnection slave 192.168.253.107:6380 192.168.253.107 6380 @ myredis_6380 192.168.253.7 6380 #Invalid argument
好吧
找到这篇文章
确实这个问题
调整下bind的监听顺序 解决
总结一下: redis sentinel 配置中如果配置了bind参数,则使用第一ip去连接,如果第一个ip是127.0.0.1,无法对外通讯,所以不要将loop地址放第一位。(通常为了安全,是一定要指定bind的……)