Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This partition is not known in the cluster view异常 #670

Closed
Skqing opened this issue Jun 6, 2022 · 4 comments
Closed

This partition is not known in the cluster view异常 #670

Skqing opened this issue Jun 6, 2022 · 4 comments

Comments

@Skqing
Copy link

Skqing commented Jun 6, 2022

版本:2.6.4

异常:

2022-06-06 15:17:01.457 [DubboServerHandler-172.16.0.47:20880-thread-199] INFO [com.alicp.jetcache.Cache.tryLock: 221] - [tryLock] [2 of 2] [8a32b434-3c84-4322-b36b-75990b1a5515] cache access failed during get lock, will inquiry 1 times. Key=rechargeLock_52806683, msg=Ex : class io.lettuce.core.cluster.UnknownPartitionException, Connection to 172.16.0.34:6379 not allowed. This partition is not known in the cluster view.
2022-06-06 15:17:01.458 [JetCacheDefaultExecutor] ERROR [com.alicp.jetcache.AbstractCache.logError: 58] - jetcache(RedisLettuceCache) GET error. key=[rechargeLock_52806683]
io.lettuce.core.cluster.UnknownPartitionException: Connection to 172.16.0.34:6379 not allowed. This partition is not known in the cluster view.
        at io.lettuce.core.cluster.PooledClusterConnectionProvider.connectionAttemptRejected(PooledClusterConnectionProvider.java:608) ~[lettuce-core-5.3.5.RELEASE.jar!/:5.3.5.RELEASE]
        at io.lettuce.core.cluster.PooledClusterConnectionProvider.beforeGetConnection(PooledClusterConnectionProvider.java:460) ~[lettuce-core-5.3.5.RELEASE.jar!/:5.3.5.RELEASE]
        at io.lettuce.core.cluster.PooledClusterConnectionProvider.getConnectionAsync(PooledClusterConnectionProvider.java:437) ~[lettuce-core-5.3.5.RELEASE.jar!/:5.3.5.RELEASE]
        at io.lettuce.core.cluster.ClusterDistributionChannelWriter.doWrite(ClusterDistributionChannelWriter.java:106) ~[lettuce-core-5.3.5.RELEASE.jar!/:5.3.5.RELEASE]
        at io.lettuce.core.cluster.ClusterDistributionChannelWriter.write(ClusterDistributionChannelWriter.java:81) ~[lettuce-core-5.3.5.RELEASE.jar!/:5.3.5.RELEASE]
        at io.lettuce.core.cluster.ClusterCommand.complete(ClusterCommand.java:59) ~[lettuce-core-5.3.5.RELEASE.jar!/:5.3.5.RELEASE]
        at io.lettuce.core.protocol.CommandWrapper.complete(CommandWrapper.java:59) ~[lettuce-core-5.3.5.RELEASE.jar!/:5.3.5.RELEASE]
        at io.lettuce.core.protocol.CommandHandler.complete(CommandHandler.java:680) ~[lettuce-core-5.3.5.RELEASE.jar!/:5.3.5.RELEASE]
        at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:640) ~[lettuce-core-5.3.5.RELEASE.jar!/:5.3.5.RELEASE]
        at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:591) ~[lettuce-core-5.3.5.RELEASE.jar!/:5.3.5.RELEASE]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[netty-transport-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719) ~[netty-transport-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) ~[netty-transport-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) ~[netty-transport-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) ~[netty-transport-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[netty-common-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.55.Final.jar!/:4.1.55.Final]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.55.Final.jar!/:4.1.55.Final]
        at java.lang.Thread.run(Thread.java:853) [?:1.8.0_302]
        at com.alibaba.wisp.engine.WispTask.runOutsideWisp(WispTask.java:295) [?:1.8.0_302]

问题原因参考:
https://blog.csdn.net/adorechen/article/details/106057389

原因:RedisClient启动的时候没有启用topology view自动刷新,导致有节点变化时,不能连接到正确节点。

解决方案:

ClusterTopologyRefreshOptions topologyRefreshOptions = ClusterTopologyRefreshOptions.builder()
                .enablePeriodicRefresh(10, TimeUnit.MINUTES)
                .enableAllAdaptiveRefreshTriggers()
                .build();

client.setOptions(ClusterClientOptions.builder()
                       .topologyRefreshOptions(topologyRefreshOptions)
                       .build());

目前jetcache里面的初始化代码是没有这一段配置的,作者要不要考虑一下?

RedisURI uri = uriList.get(0);
if ("Cluster".equalsIgnoreCase(mode)) {
    client = RedisClusterClient.create(uri);
    ((RedisClusterClient) client).setOptions(ClusterClientOptions.builder().
            disconnectedBehavior(ClientOptions.DisconnectedBehavior.REJECT_COMMANDS).build());
    if (readFrom != null) {
        StatefulRedisClusterConnection c = ((RedisClusterClient) client).connect(new JetCacheCodec());
        c.setReadFrom(readFrom);
        connection = c;
    }
}
@areyouok
Copy link
Collaborator

areyouok commented Jun 7, 2022

我把这两个设置加进去吧, 但是lettuce的选项太多了还经常修改,所以做不到支持所有的选项。如果你想深度定制参数,可以使用类似这里的方法自己在java代码中配置lettuce:

https://github.com/alibaba/jetcache/wiki/GettingStarted

@areyouok
Copy link
Collaborator

areyouok commented Jun 7, 2022

已经改过了,你自己用2.6分支打个包吧

@Skqing
Copy link
Author

Skqing commented Jun 8, 2022

已经改过了,你自己用2.6分支打个包吧

多谢!

@Skqing
Copy link
Author

Skqing commented Jun 8, 2022

我把这两个设置加进去吧, 但是lettuce的选项太多了还经常修改,所以做不到支持所有的选项。如果你想深度定制参数,可以使用类似这里的方法自己在java代码中配置lettuce:

https://github.com/alibaba/jetcache/wiki/GettingStarted

好的

@Skqing Skqing closed this as completed Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants