Lettuce: Connection to x.x.x.x not allowed. This connection point is not known in the cluster view

简介: Lettuce: Connection to x.x.x.x not allowed. This connection point is not known in the cluster view

可能原因

  1. Lettuce 会在本地维护一份cluster nodes返回的信息作为路由表。
  2. validateClusterNodeMembership 是 Lettuce 一个客户端 option,会检查某命令访问的地址,是否在第1步维护的路由表中,此参数默认值为true,即开启检查。
  3. 当 Lettuce 连接 Redis 集群且没有配置 topologyRefreshOptions 时,意味着路由表变化之后,第1步中的路由表不会更新。
  4. 但是路由变化时返回的MOVED xxx xxx告诉客户端去访问 xxx 新地址,但是因为此地址不在路由表中,第2步的检测就会报错

建议方法

方法一(推荐):设置topologyRefreshOptions选项

ClusterTopologyRefreshOptions topologyRefreshOptions = ClusterTopologyRefreshOptions.builder()
                .enablePeriodicRefresh(refreshPeriod(10, TimeUnit.MINUTES))
                .enableAllAdaptiveRefreshTriggers()
                .build();
client.setOptions(ClusterClientOptions.builder()
                       .topologyRefreshOptions(topologyRefreshOptions)
                       .build());

方法二(不推荐):设置validateClusterNodeMembership为false,可临时绕过此检查。

github路由表讨论


相关文章
|
9月前
|
SQL 关系型数据库 MySQL
SQL Error (2013): Lost connection to MySQL server at 'waiting for initial communication packet', sys...
SQL Error (2013): Lost connection to MySQL server at 'waiting for initial communication packet', sys...
226 0
|
6月前
|
数据库连接 网络安全 数据库
Could not create connection to database server.Attempted reconnect 3 times. Giving up.
这篇文章提供了解决数据库连接问题的方法,建议在连接字符串后添加`?serverTimezone=UTC`来指定时区,并检查网络设置、连接属性、驱动版本以及是否需要SSH或SSL连接。
Could not create connection to database server.Attempted reconnect 3 times. Giving up.
|
数据库
Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Could not create connection to database server. Attempted reconnect 3 times. Giving up.
199 0
|
数据采集
Proxy-Connection 和 Connection 有什么区别
Proxy-Connection 是一个 HTTP 请求头,它用于在客户端和代理服务器之问传递连接相关的信息。它的作用是协商浏览器和代理之间的连接是否保持,以及处理一些不兼容的情况。简单来说,Proxy-Connection 是一个为了兼容性而存在的头,而 Connection 是一个为了性能而存在的头。
276 0
|
缓存 网络协议 关系型数据库
从Host blocked报错学习max_connect_errors
1.案发现场-Host blocked 一个案例场景是大数据抽取job任务连接MySQL实例抽数,任务报错如下图所示:报错表示,host被锁是由于有大量的连接错误,如果要解锁就执行mysqladmin flush-hosts;知识点!!!线索:host被锁,大量连接错误证人提示线索:确认最近新加p.
1539 0
从Host blocked报错学习max_connect_errors