Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kotlin RedisClusterCommands scriptLoad()_Kotlin_Redis Cluster_Lettuce - Fatal编程技术网

Kotlin RedisClusterCommands scriptLoad()

Kotlin RedisClusterCommands scriptLoad(),kotlin,redis-cluster,lettuce,Kotlin,Redis Cluster,Lettuce,我正在使用莴苣库连接到Redis群集服务器,当我尝试调用RedisClusterCommands.scriptLoad()时,它出错。它会引发异常: io.lettuce.core.RedisException: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /127.0.0.1:7004 at io.lettuce.core.LettuceFutures.awaitOrCa

我正在使用莴苣库连接到Redis群集服务器,当我尝试调用RedisClusterCommands.scriptLoad()时,它出错。它会引发异常:

io.lettuce.core.RedisException: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /127.0.0.1:7004
    at io.lettuce.core.LettuceFutures.awaitOrCancel(LettuceFutures.java:129) ~[lettuce-core-5.1.6.RELEASE.jar:?]
    at io.lettuce.core.cluster.ClusterFutureSyncInvocationHandler.handleInvocation(ClusterFutureSyncInvocationHandler.java:123) ~[lettuce-core-5.1.6.RELEASE.jar:?]
    at io.lettuce.core.internal.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:80) ~[lettuce-core-5.1.6.RELEASE.jar:?]
    at com.sun.proxy.$Proxy123.scriptLoad(Unknown Source) ~[?:?]
    at com.slotty.common.services.redis.RedisManager.loadLuaScriptRaw(RedisManager.kt:106) ~[com.slotty.common-2.0.0.jar:?]
    at com.slotty.common.services.redis.RedisManager.loadLuaScript(RedisManager.kt:77) ~[com.slotty.common-2.0.0.jar:?]
    at com.slotty.core.server.BaseServer.createServerStore(BaseServer.kt:154) ~[com.slotty.core-2.0.0.jar:?]
    at com.slotty.core.server.BaseServer.initStores(BaseServer.kt:150) ~[com.slotty.core-2.0.0.jar:?]
    at com.slotty.core.server.BaseZone.initStores(BaseZone.kt:163) ~[com.slotty.core-2.0.0.jar:?]
    at com.slotty.core.server.BaseServer.initServices(BaseServer.kt:87) ~[com.slotty.core-2.0.0.jar:?]
    at com.slotty.core.server.BaseZone.initServices(BaseZone.kt:49) ~[com.slotty.core-2.0.0.jar:?]
    at com.slotty.core.server.BaseServer.initialize(BaseServer.kt:65) ~[com.slotty.core-2.0.0.jar:?]
    at com.slotty.core.server.BaseServer.init(BaseServer.kt:55) [com.slotty.core-2.0.0.jar:?]
    at com.smartfoxserver.v2.entities.managers.SFSExtensionManager.createExtension(SFSExtensionManager.java:303) [sfs2x.jar:?]
    at com.smartfoxserver.v2.entities.managers.SFSZoneManager.createZone(SFSZoneManager.java:426) [sfs2x.jar:?]
    at com.smartfoxserver.v2.entities.managers.SFSZoneManager.initializeZones(SFSZoneManager.java:239) [sfs2x.jar:?]
    at com.smartfoxserver.v2.SmartFoxServer.start(SmartFoxServer.java:292) [sfs2x.jar:?]
    at com.smartfoxserver.v2.Main.main(Main.java:14) [sfs2x.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_102]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_102]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_102]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_102]
    at com.exe4j.runtime.LauncherEngine.launch(Unknown Source) [i4jruntime.jar:?]
    at com.install4j.runtime.launcher.Launcher.main(Unknown Source) [i4jruntime.jar:?]
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /127.0.0.1:7004
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[?:1.8.0_102]
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[?:1.8.0_102]
    at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:327) ~[netty-transport-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340) ~[netty-transport-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:665) ~[netty-transport-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:612) ~[netty-transport-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:529) ~[netty-transport-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:491) ~[netty-transport-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905) ~[netty-common-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.33.Final.jar:4.1.33.Final]
    at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_102]
Caused by: java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[?:1.8.0_102]
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[?:1.8.0_102]
    at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:327) ~[netty-transport-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340) ~[netty-transport-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:665) ~[netty-transport-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:612) ~[netty-transport-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:529) ~[netty-transport-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:491) ~[netty-transport-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905) ~[netty-common-4.1.33.Final.jar:4.1.33.Final]
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.33.Final.jar:4.1.33.Final]
    at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_102]
这是我的初始化连接代码: 我尝试使用RedisClusterClient连接到redis服务器。IP为10.10.10.1,端口为7000

    val redisUri = with(redisServiceInfo) {
                RedisURI.builder()
                        .withHost(host)
                        .also { if (password != null) it.withPassword(password) }
                        .withPort(port)
                        .withTimeout(Duration.ofMillis(timeout))
                        .build()
            }
            val clusterClient = RedisClusterClient.create(redisUri)      
            val connection = clusterClient.connect()       
            this.connection = connection
            this.clusterClient = clusterClient
然后我通过redisClusterCommand执行脚本加载

shaResult = redisService.sync().scriptLoad(script)
我的Redis服务器有6个节点:3个主节点3个从节点7000->7002的端口是主节点,7003->7005的端口是从节点。测试后发现连接随机返回不同主机名的URI,有时返回redis.domain.local有时返回正确的ip,有时返回127.0.0.1

连接到服务器后,我尝试将节点的IP替换为10.10.10.1,功能正常

建立连接时是否有任何配置丢失