netease-im / camellia

Camellia provide easy-to-use server toolkits, such as: redis proxy、delay queue、id gen、hot key and more
MIT License
620 stars 142 forks source link

java.io.IOException: Connection reset by peer #130

Closed InputOutputZ closed 1 year ago

InputOutputZ commented 1 year ago

Module: camellia-redis-proxy Version: 1.2.14 Content:

Hi there,

I just wanted to say thanks so much for the dev work to bring this proxy and I have a question, I wonder if there is anything wrong in my configuration since I couldn't figure out the reason I get these errors when I run start.sh

_________                       .__  .__  .__        
\_   ___ \_____    _____   ____ |  | |  | |__|____   
/    \  \/\__  \  /     \_/ __ \|  | |  | |  \__  \  
\     \____/ __ \|  Y Y  \  ___/|  |_|  |_|  |/ __ \_
 \______  (____  /__|_|  /\___  >____/____/__(____  /
        \/     \/      \/     \/                  \/ 
 :: Camellia-Redis-Proxy-Server ::          (1.2.14)

2023-08-18 17:52:51,654 INFO  main  c.n.n.c.r.p.b.Application:50 - Starting Application on server.zakaria.website with PID 92124 (/root/camellia-redis-proxy-1.2.14/BOOT-INF/classes started by root in /root/camellia-redis-proxy-1.2.14)
2023-08-18 17:52:51,666 INFO  main  c.n.n.c.r.p.b.Application:654 - No active profile set, falling back to default profiles: default
2023-08-18 17:52:51,788 INFO  main  o.s.c.a.AnnotationConfigApplicationContext:592 - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@2f410acf: startup date [Fri Aug 18 17:52:51 UTC 2023]; root of context hierarchy
2023-08-18 17:52:52,981 INFO  main  c.n.n.c.r.p.p.DefaultBeanFactory:41 - try init com.netease.nim.camellia.redis.proxy.command.DefaultQueueFactory
2023-08-18 17:52:52,981 INFO  main  c.n.n.c.r.p.p.DefaultBeanFactory:43 - init com.netease.nim.camellia.redis.proxy.command.DefaultQueueFactory success
2023-08-18 17:52:53,005 INFO  main  c.n.n.c.r.p.p.DefaultBeanFactory:41 - try init com.netease.nim.camellia.redis.proxy.conf.FileBasedProxyDynamicConfLoader
2023-08-18 17:52:53,006 INFO  main  c.n.n.c.r.p.p.DefaultBeanFactory:43 - init com.netease.nim.camellia.redis.proxy.conf.FileBasedProxyDynamicConfLoader success
2023-08-18 17:52:53,010 INFO  main  c.n.n.c.r.p.c.ProxyDynamicConf:72 - ProxyDynamicConf updated, conf.size = 14, conf = {proxy.frontend.tls.key.file=rediskey.pem, proxy.frontend.tls.cert.file.path=/etc/redis/cert/redis.pem, proxy.frontend.tls.cert.file=redis.pem, proxy.frontend.tls.ca.cert.file=ca.pem, proxy.upstream.tls.cert.file=client.pem, proxy.upstream.tls.key.file=clientkey.pem, proxy.upstream.tls.ca.cert.file.path=/etc/redis/cert/ca.pem, proxy.frontend.tls.key.file.path=/etc/redis/cert/rediskey.pem, proxy.frontend.tls.ca.cert.file.path=/etc/redis/cert/ca.pem, proxy.upstream.tls.cert.file.path=/etc/redis/cert/client.pem, proxy.upstream.tls.config=[{"resource":"redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384","ca.cert.file.path":"/etc/redis/cert/ca.pem","cert.file.path":"/etc/redis/cert/client.pem","key.file.path":"/etc/redis/cert/clientkey.pem"}], proxy.upstream.tls.key.file.path=/etc/redis/cert/clientkey.pem, proxy.cluster.mode.nodes=127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384, proxy.upstream.tls.ca.cert.file=ca.pem}
2023-08-18 17:52:53,027 INFO  main  c.n.n.c.r.p.c.ProxyDynamicConf:52 - ProxyDynamicConf init, loader = com.netease.nim.camellia.redis.proxy.conf.FileBasedProxyDynamicConfLoader, reloadIntervalSeconds = 600
2023-08-18 17:52:53,032 INFO  main  c.n.n.c.r.p.u.c.RedisConnectionHub:92 - RedisConnectionHub, connectTimeoutMillis = 1000, heartbeatIntervalSeconds = 60, heartbeatTimeoutMillis = 10000
2023-08-18 17:52:53,035 INFO  main  c.n.n.c.r.p.u.c.RedisConnectionHub:107 - RedisConnectionHub, failCountThreshold = 5, failBanMillis = 5000
2023-08-18 17:52:53,036 INFO  main  c.n.n.c.r.p.u.c.RedisConnectionHub:111 - RedisConnectionHub, closeIdleConnection = true, checkIdleConnectionThresholdSeconds = 600, closeIdleConnectionDelaySeconds = 60
2023-08-18 17:52:53,037 INFO  main  c.n.n.c.r.p.u.c.RedisConnectionHub:122 - RedisConnectionHub, so_keepalive = true, tcp_no_delay = true, tcp_quick_ack = false, so_rcvbuf = 10485760, so_sndbuf = 10485760, write_buffer_water_mark_Low = 131072, write_buffer_water_mark_high = 524288
2023-08-18 17:52:53,038 INFO  main  c.n.n.c.r.p.p.DefaultBeanFactory:41 - try init com.netease.nim.camellia.redis.proxy.tls.upstream.DefaultProxyUpstreamTlsProvider
2023-08-18 17:52:53,039 INFO  main  c.n.n.c.r.p.p.DefaultBeanFactory:43 - init com.netease.nim.camellia.redis.proxy.tls.upstream.DefaultProxyUpstreamTlsProvider success
2023-08-18 17:52:53,167 WARN  main  c.n.n.c.r.p.t.u.DefaultProxyUpstreamTlsProvider:78 - illegal upstream ssl config, tls disable, resource = redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
2023-08-18 17:52:53,169 INFO  main  c.n.n.c.r.p.u.c.RedisConnectionHub:129 - RedisConnectionHub, ProxyUpstreamTlsProvider = com.netease.nim.camellia.redis.proxy.tls.upstream.DefaultProxyUpstreamTlsProvider, init = true
2023-08-18 17:52:53,189 INFO  main  c.n.n.c.r.p.u.u.ScheduledResourceChecker:32 - ScheduledResourceChecker start, intervalSeconds = 5
2023-08-18 17:52:53,189 INFO  main  c.n.n.c.r.p.u.UpstreamRedisClientTemplateFactory:206 - CamelliaRedisProxy init, type = LOCAL
2023-08-18 17:52:53,213 INFO  main  c.n.n.c.r.p.u.UpstreamRedisClientTemplate:78 - UpstreamRedisClientTemplate multiWriteMode init, bid = -1, bgroup = local, multiWriteMode = FIRST_RESOURCE_ONLY
2023-08-18 17:52:53,271 INFO  main  c.n.n.c.r.p.u.c.RedisConnection:141 - RedisConnection[@127.0.0.1:6383][id=1] try connect...
2023-08-18 17:52:53,454 INFO  main  c.n.n.c.r.p.u.c.RedisClusterSlotInfo:382 - tryRenew, connection = RedisConnection[@127.0.0.1:6383][id=1], resource = redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
2023-08-18 17:52:53,468 INFO  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:152 - RedisConnection[@127.0.0.1:6383][id=1] connect success
2023-08-18 17:52:53,472 INFO  camellia-redis-connection-initialize-8-1  c.n.n.c.r.p.u.c.RedisConnection:430 - RedisConnection[@127.0.0.1:6383][id=1] send `PING` command
2023-08-18 17:52:53,524 WARN  camellia-redis-connection-7-1  i.n.c.DefaultChannelPipeline:1152 - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.io.IOException: Connection reset by peer
    at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
    at sun.nio.ch.IOUtil.read(IOUtil.java:192)
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
    at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:254)
    at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
    at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
2023-08-18 17:52:53,526 WARN  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:146 - RedisConnection[@127.0.0.1:6383][id=1] disconnect
2023-08-18 17:52:53,527 WARN  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:471 - RedisConnection[@127.0.0.1:6383][id=1] stopping, grace = false
2023-08-18 17:52:53,530 ERROR camellia-redis-connection-initialize-8-1  c.n.n.c.r.p.u.c.RedisConnection:443 - RedisConnection[@127.0.0.1:6383][id=1] send `PING` command fail, reply = ERR proxy upstream connection not available
2023-08-18 17:52:53,531 ERROR camellia-redis-connection-initialize-8-1  c.n.n.c.r.p.u.c.RedisConnection:395 - RedisConnection[@127.0.0.1:6383][id=1] initialize fail
com.netease.nim.camellia.redis.base.exception.CamelliaRedisException: ping fail
    at com.netease.nim.camellia.redis.proxy.upstream.connection.RedisConnection.ping(RedisConnection.java:444)
    at com.netease.nim.camellia.redis.proxy.upstream.connection.RedisConnection.initialize(RedisConnection.java:367)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
2023-08-18 17:52:53,538 ERROR main  c.n.n.c.r.p.u.c.RedisClusterSlotInfo:386 - tryRenew error, host = 127.0.0.1, port = 6383, resource = redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
com.netease.nim.camellia.redis.base.exception.CamelliaRedisException: ERR proxy upstream connection not available
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.clusterNodes(RedisClusterSlotInfo.java:439)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.tryRenew(RedisClusterSlotInfo.java:384)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.renew(RedisClusterSlotInfo.java:278)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterClient.renew0(RedisClusterClient.java:113)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterClient.start(RedisClusterClient.java:96)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.lambda$get$2(UpstreamRedisClientFactory.java:77)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.get(UpstreamRedisClientFactory.java:74)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.get(UpstreamRedisClientFactory.java:240)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.update(UpstreamRedisClientTemplate.java:662)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.<init>(UpstreamRedisClientTemplate.java:122)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.<init>(UpstreamRedisClientTemplate.java:94)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.initLocal(UpstreamRedisClientTemplateFactory.java:234)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.init(UpstreamRedisClientTemplateFactory.java:208)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.<init>(UpstreamRedisClientTemplateFactory.java:58)
    at com.netease.nim.camellia.redis.proxy.util.ConfigInitUtil.initUpstreamClientTemplateFactory(ConfigInitUtil.java:27)
    at com.netease.nim.camellia.redis.proxy.command.CommandInvoker.<init>(CommandInvoker.java:37)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration.redisProxyBoot(CamelliaRedisProxyConfiguration.java:67)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3.CGLIB$redisProxyBoot$3(<generated>)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3$$FastClassBySpringCGLIB$$e15a182b.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:365)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3.redisProxyBoot(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:583)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:881)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)
    at com.netease.nim.camellia.redis.proxy.bootstrap.Application.main(Application.java:12)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
2023-08-18 17:52:53,540 ERROR camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:498 - RedisConnection[@127.0.0.1:6383][id=1] stopped, pendingCommands = 1, cachedCommands = 1 return NOT_AVAILABLE
2023-08-18 17:52:53,540 INFO  main  c.n.n.c.r.p.u.c.RedisConnection:141 - RedisConnection[@127.0.0.1:6381][id=2] try connect...
2023-08-18 17:52:53,543 INFO  main  c.n.n.c.r.p.u.c.RedisClusterSlotInfo:382 - tryRenew, connection = RedisConnection[@127.0.0.1:6381][id=2], resource = redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
2023-08-18 17:52:53,556 INFO  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:152 - RedisConnection[@127.0.0.1:6381][id=2] connect success
2023-08-18 17:52:53,557 INFO  camellia-redis-connection-initialize-8-2  c.n.n.c.r.p.u.c.RedisConnection:430 - RedisConnection[@127.0.0.1:6381][id=2] send `PING` command
2023-08-18 17:52:53,560 WARN  camellia-redis-connection-7-1  i.n.c.DefaultChannelPipeline:1152 - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.io.IOException: Connection reset by peer
    at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
    at sun.nio.ch.IOUtil.read(IOUtil.java:192)
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
    at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:254)
    at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
    at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
2023-08-18 17:52:53,560 WARN  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:146 - RedisConnection[@127.0.0.1:6381][id=2] disconnect
2023-08-18 17:52:53,560 WARN  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:471 - RedisConnection[@127.0.0.1:6381][id=2] stopping, grace = false
2023-08-18 17:52:53,561 ERROR main  c.n.n.c.r.p.u.c.RedisClusterSlotInfo:386 - tryRenew error, host = 127.0.0.1, port = 6381, resource = redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
com.netease.nim.camellia.redis.base.exception.CamelliaRedisException: ERR proxy upstream connection not available
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.clusterNodes(RedisClusterSlotInfo.java:439)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.tryRenew(RedisClusterSlotInfo.java:384)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.renew(RedisClusterSlotInfo.java:278)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterClient.renew0(RedisClusterClient.java:113)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterClient.start(RedisClusterClient.java:96)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.lambda$get$2(UpstreamRedisClientFactory.java:77)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.get(UpstreamRedisClientFactory.java:74)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.get(UpstreamRedisClientFactory.java:240)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.update(UpstreamRedisClientTemplate.java:662)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.<init>(UpstreamRedisClientTemplate.java:122)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.<init>(UpstreamRedisClientTemplate.java:94)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.initLocal(UpstreamRedisClientTemplateFactory.java:234)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.init(UpstreamRedisClientTemplateFactory.java:208)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.<init>(UpstreamRedisClientTemplateFactory.java:58)
    at com.netease.nim.camellia.redis.proxy.util.ConfigInitUtil.initUpstreamClientTemplateFactory(ConfigInitUtil.java:27)
    at com.netease.nim.camellia.redis.proxy.command.CommandInvoker.<init>(CommandInvoker.java:37)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration.redisProxyBoot(CamelliaRedisProxyConfiguration.java:67)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3.CGLIB$redisProxyBoot$3(<generated>)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3$$FastClassBySpringCGLIB$$e15a182b.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:365)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3.redisProxyBoot(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:583)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:881)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)
    at com.netease.nim.camellia.redis.proxy.bootstrap.Application.main(Application.java:12)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
2023-08-18 17:52:53,562 INFO  main  c.n.n.c.r.p.u.c.RedisConnection:141 - RedisConnection[@127.0.0.1:6384][id=3] try connect...
2023-08-18 17:52:53,564 INFO  main  c.n.n.c.r.p.u.c.RedisClusterSlotInfo:382 - tryRenew, connection = RedisConnection[@127.0.0.1:6384][id=3], resource = redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
2023-08-18 17:52:53,561 ERROR camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:498 - RedisConnection[@127.0.0.1:6381][id=2] stopped, pendingCommands = 1, cachedCommands = 1 return NOT_AVAILABLE
2023-08-18 17:52:53,565 INFO  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:152 - RedisConnection[@127.0.0.1:6384][id=3] connect success
2023-08-18 17:52:53,568 INFO  camellia-redis-connection-initialize-8-1  c.n.n.c.r.p.u.c.RedisConnection:430 - RedisConnection[@127.0.0.1:6384][id=3] send `PING` command
2023-08-18 17:52:53,572 ERROR camellia-redis-connection-initialize-8-2  c.n.n.c.r.p.u.c.RedisConnection:443 - RedisConnection[@127.0.0.1:6381][id=2] send `PING` command fail, reply = ERR proxy upstream connection not available
2023-08-18 17:52:53,571 WARN  camellia-redis-connection-7-1  i.n.c.DefaultChannelPipeline:1152 - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.io.IOException: Connection reset by peer
    at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
    at sun.nio.ch.IOUtil.read(IOUtil.java:192)
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
    at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:254)
    at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
    at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
2023-08-18 17:52:53,572 WARN  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:146 - RedisConnection[@127.0.0.1:6384][id=3] disconnect
2023-08-18 17:52:53,572 ERROR camellia-redis-connection-initialize-8-2  c.n.n.c.r.p.u.c.RedisConnection:395 - RedisConnection[@127.0.0.1:6381][id=2] initialize fail
com.netease.nim.camellia.redis.base.exception.CamelliaRedisException: ping fail
    at com.netease.nim.camellia.redis.proxy.upstream.connection.RedisConnection.ping(RedisConnection.java:444)
    at com.netease.nim.camellia.redis.proxy.upstream.connection.RedisConnection.initialize(RedisConnection.java:367)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
2023-08-18 17:52:53,573 WARN  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:471 - RedisConnection[@127.0.0.1:6384][id=3] stopping, grace = false
2023-08-18 17:52:53,573 ERROR camellia-redis-connection-initialize-8-1  c.n.n.c.r.p.u.c.RedisConnection:443 - RedisConnection[@127.0.0.1:6384][id=3] send `PING` command fail, reply = ERR proxy upstream connection not available
2023-08-18 17:52:53,573 ERROR camellia-redis-connection-initialize-8-1  c.n.n.c.r.p.u.c.RedisConnection:395 - RedisConnection[@127.0.0.1:6384][id=3] initialize fail
com.netease.nim.camellia.redis.base.exception.CamelliaRedisException: ping fail
    at com.netease.nim.camellia.redis.proxy.upstream.connection.RedisConnection.ping(RedisConnection.java:444)
    at com.netease.nim.camellia.redis.proxy.upstream.connection.RedisConnection.initialize(RedisConnection.java:367)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
2023-08-18 17:52:53,574 ERROR main  c.n.n.c.r.p.u.c.RedisClusterSlotInfo:386 - tryRenew error, host = 127.0.0.1, port = 6384, resource = redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
com.netease.nim.camellia.redis.base.exception.CamelliaRedisException: ERR proxy upstream connection not available
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.clusterNodes(RedisClusterSlotInfo.java:439)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.tryRenew(RedisClusterSlotInfo.java:384)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.renew(RedisClusterSlotInfo.java:278)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterClient.renew0(RedisClusterClient.java:113)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterClient.start(RedisClusterClient.java:96)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.lambda$get$2(UpstreamRedisClientFactory.java:77)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.get(UpstreamRedisClientFactory.java:74)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.get(UpstreamRedisClientFactory.java:240)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.update(UpstreamRedisClientTemplate.java:662)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.<init>(UpstreamRedisClientTemplate.java:122)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.<init>(UpstreamRedisClientTemplate.java:94)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.initLocal(UpstreamRedisClientTemplateFactory.java:234)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.init(UpstreamRedisClientTemplateFactory.java:208)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.<init>(UpstreamRedisClientTemplateFactory.java:58)
    at com.netease.nim.camellia.redis.proxy.util.ConfigInitUtil.initUpstreamClientTemplateFactory(ConfigInitUtil.java:27)
    at com.netease.nim.camellia.redis.proxy.command.CommandInvoker.<init>(CommandInvoker.java:37)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration.redisProxyBoot(CamelliaRedisProxyConfiguration.java:67)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3.CGLIB$redisProxyBoot$3(<generated>)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3$$FastClassBySpringCGLIB$$e15a182b.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:365)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3.redisProxyBoot(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:583)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:881)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)
    at com.netease.nim.camellia.redis.proxy.bootstrap.Application.main(Application.java:12)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
2023-08-18 17:52:53,575 INFO  main  c.n.n.c.r.p.u.c.RedisConnection:141 - RedisConnection[@127.0.0.1:6380][id=4] try connect...
2023-08-18 17:52:53,576 INFO  main  c.n.n.c.r.p.u.c.RedisClusterSlotInfo:382 - tryRenew, connection = RedisConnection[@127.0.0.1:6380][id=4], resource = redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
2023-08-18 17:52:53,576 ERROR camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:498 - RedisConnection[@127.0.0.1:6384][id=3] stopped, pendingCommands = 1, cachedCommands = 1 return NOT_AVAILABLE
2023-08-18 17:52:53,579 INFO  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:152 - RedisConnection[@127.0.0.1:6380][id=4] connect success
2023-08-18 17:52:53,579 INFO  camellia-redis-connection-initialize-8-2  c.n.n.c.r.p.u.c.RedisConnection:430 - RedisConnection[@127.0.0.1:6380][id=4] send `PING` command
2023-08-18 17:52:53,581 WARN  camellia-redis-connection-7-1  i.n.c.DefaultChannelPipeline:1152 - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.io.IOException: Connection reset by peer
    at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
    at sun.nio.ch.IOUtil.read(IOUtil.java:192)
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
    at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:254)
    at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
    at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
2023-08-18 17:52:53,583 WARN  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:146 - RedisConnection[@127.0.0.1:6380][id=4] disconnect
2023-08-18 17:52:53,585 WARN  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:471 - RedisConnection[@127.0.0.1:6380][id=4] stopping, grace = false
2023-08-18 17:52:53,586 ERROR camellia-redis-connection-initialize-8-2  c.n.n.c.r.p.u.c.RedisConnection:443 - RedisConnection[@127.0.0.1:6380][id=4] send `PING` command fail, reply = ERR proxy upstream connection not available
2023-08-18 17:52:53,586 ERROR camellia-redis-connection-initialize-8-2  c.n.n.c.r.p.u.c.RedisConnection:395 - RedisConnection[@127.0.0.1:6380][id=4] initialize fail
com.netease.nim.camellia.redis.base.exception.CamelliaRedisException: ping fail
    at com.netease.nim.camellia.redis.proxy.upstream.connection.RedisConnection.ping(RedisConnection.java:444)
    at com.netease.nim.camellia.redis.proxy.upstream.connection.RedisConnection.initialize(RedisConnection.java:367)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
2023-08-18 17:52:53,587 ERROR main  c.n.n.c.r.p.u.c.RedisClusterSlotInfo:386 - tryRenew error, host = 127.0.0.1, port = 6380, resource = redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
com.netease.nim.camellia.redis.base.exception.CamelliaRedisException: ERR proxy upstream connection not available
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.clusterNodes(RedisClusterSlotInfo.java:439)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.tryRenew(RedisClusterSlotInfo.java:384)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.renew(RedisClusterSlotInfo.java:278)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterClient.renew0(RedisClusterClient.java:113)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterClient.start(RedisClusterClient.java:96)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.lambda$get$2(UpstreamRedisClientFactory.java:77)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.get(UpstreamRedisClientFactory.java:74)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.get(UpstreamRedisClientFactory.java:240)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.update(UpstreamRedisClientTemplate.java:662)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.<init>(UpstreamRedisClientTemplate.java:122)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.<init>(UpstreamRedisClientTemplate.java:94)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.initLocal(UpstreamRedisClientTemplateFactory.java:234)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.init(UpstreamRedisClientTemplateFactory.java:208)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.<init>(UpstreamRedisClientTemplateFactory.java:58)
    at com.netease.nim.camellia.redis.proxy.util.ConfigInitUtil.initUpstreamClientTemplateFactory(ConfigInitUtil.java:27)
    at com.netease.nim.camellia.redis.proxy.command.CommandInvoker.<init>(CommandInvoker.java:37)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration.redisProxyBoot(CamelliaRedisProxyConfiguration.java:67)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3.CGLIB$redisProxyBoot$3(<generated>)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3$$FastClassBySpringCGLIB$$e15a182b.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:365)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3.redisProxyBoot(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:583)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:881)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)
    at com.netease.nim.camellia.redis.proxy.bootstrap.Application.main(Application.java:12)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
2023-08-18 17:52:53,588 INFO  main  c.n.n.c.r.p.u.c.RedisConnection:141 - RedisConnection[@127.0.0.1:6382][id=5] try connect...
2023-08-18 17:52:53,589 INFO  main  c.n.n.c.r.p.u.c.RedisClusterSlotInfo:382 - tryRenew, connection = RedisConnection[@127.0.0.1:6382][id=5], resource = redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
2023-08-18 17:52:53,589 ERROR camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:498 - RedisConnection[@127.0.0.1:6380][id=4] stopped, pendingCommands = 1, cachedCommands = 1 return NOT_AVAILABLE
2023-08-18 17:52:53,590 INFO  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:152 - RedisConnection[@127.0.0.1:6382][id=5] connect success
2023-08-18 17:52:53,590 INFO  camellia-redis-connection-initialize-8-1  c.n.n.c.r.p.u.c.RedisConnection:430 - RedisConnection[@127.0.0.1:6382][id=5] send `PING` command
2023-08-18 17:52:53,592 WARN  camellia-redis-connection-7-1  i.n.c.DefaultChannelPipeline:1152 - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.io.IOException: Connection reset by peer
    at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
    at sun.nio.ch.IOUtil.read(IOUtil.java:192)
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
    at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:254)
    at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
    at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
2023-08-18 17:52:53,593 WARN  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:146 - RedisConnection[@127.0.0.1:6382][id=5] disconnect
2023-08-18 17:52:53,593 WARN  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:471 - RedisConnection[@127.0.0.1:6382][id=5] stopping, grace = false
2023-08-18 17:52:53,593 ERROR camellia-redis-connection-initialize-8-1  c.n.n.c.r.p.u.c.RedisConnection:443 - RedisConnection[@127.0.0.1:6382][id=5] send `PING` command fail, reply = ERR proxy upstream connection not available
2023-08-18 17:52:53,594 ERROR camellia-redis-connection-initialize-8-1  c.n.n.c.r.p.u.c.RedisConnection:395 - RedisConnection[@127.0.0.1:6382][id=5] initialize fail
com.netease.nim.camellia.redis.base.exception.CamelliaRedisException: ping fail
    at com.netease.nim.camellia.redis.proxy.upstream.connection.RedisConnection.ping(RedisConnection.java:444)
    at com.netease.nim.camellia.redis.proxy.upstream.connection.RedisConnection.initialize(RedisConnection.java:367)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
2023-08-18 17:52:53,595 ERROR main  c.n.n.c.r.p.u.c.RedisClusterSlotInfo:386 - tryRenew error, host = 127.0.0.1, port = 6382, resource = redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
com.netease.nim.camellia.redis.base.exception.CamelliaRedisException: ERR proxy upstream connection not available
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.clusterNodes(RedisClusterSlotInfo.java:439)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.tryRenew(RedisClusterSlotInfo.java:384)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterSlotInfo.renew(RedisClusterSlotInfo.java:278)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterClient.renew0(RedisClusterClient.java:113)
    at com.netease.nim.camellia.redis.proxy.upstream.cluster.RedisClusterClient.start(RedisClusterClient.java:96)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.lambda$get$2(UpstreamRedisClientFactory.java:77)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.get(UpstreamRedisClientFactory.java:74)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientFactory$Default.get(UpstreamRedisClientFactory.java:240)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.update(UpstreamRedisClientTemplate.java:662)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.<init>(UpstreamRedisClientTemplate.java:122)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplate.<init>(UpstreamRedisClientTemplate.java:94)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.initLocal(UpstreamRedisClientTemplateFactory.java:234)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.init(UpstreamRedisClientTemplateFactory.java:208)
    at com.netease.nim.camellia.redis.proxy.upstream.UpstreamRedisClientTemplateFactory.<init>(UpstreamRedisClientTemplateFactory.java:58)
    at com.netease.nim.camellia.redis.proxy.util.ConfigInitUtil.initUpstreamClientTemplateFactory(ConfigInitUtil.java:27)
    at com.netease.nim.camellia.redis.proxy.command.CommandInvoker.<init>(CommandInvoker.java:37)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration.redisProxyBoot(CamelliaRedisProxyConfiguration.java:67)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3.CGLIB$redisProxyBoot$3(<generated>)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3$$FastClassBySpringCGLIB$$e15a182b.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:365)
    at com.netease.nim.camellia.redis.proxy.springboot.CamelliaRedisProxyConfiguration$$EnhancerBySpringCGLIB$$9cb61bc3.redisProxyBoot(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:583)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:881)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)
    at com.netease.nim.camellia.redis.proxy.bootstrap.Application.main(Application.java:12)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
2023-08-18 17:52:53,596 INFO  main  c.n.n.c.r.p.u.c.RedisConnection:141 - RedisConnection[@127.0.0.1:6379][id=6] try connect...
2023-08-18 17:52:53,596 INFO  main  c.n.n.c.r.p.u.c.RedisClusterSlotInfo:382 - tryRenew, connection = RedisConnection[@127.0.0.1:6379][id=6], resource = redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
2023-08-18 17:52:53,597 ERROR camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:498 - RedisConnection[@127.0.0.1:6382][id=5] stopped, pendingCommands = 1, cachedCommands = 1 return NOT_AVAILABLE
2023-08-18 17:52:53,599 INFO  camellia-redis-connection-7-1  c.n.n.c.r.p.u.c.RedisConnection:152 - RedisConnection[@127.0.0.1:6379][id=6] connect success
2023-08-18 17:52:53,599 INFO  camellia-redis-connection-initialize-8-2  c.n.n.c.r.p.u.c.RedisConnection:430 - RedisConnection[@127.0.0.1:6379][id=6] send `PING` command

I checked redis cluster log and I get this error whenever I run start.sh 34824:S 18 Aug 2023 17:52:53.601 # Error accepting a client connection: error:0A00010B:SSL routines::wrong version number

These are my configurations:-

application.yml

server:
  port: 7619
spring:
  application:
    name: camellia-redis-proxy-server

camellia-redis-proxy:
 cluster-mode-enable: true
 cport: 76190
 tls-port: 6379
 proxy-frontend-tls-provider-class-name: com.netease.nim.camellia.redis.proxy.tls.frontend.DefaultProxyFrontendTlsProvider
 password: mypassword
 transpond:
  local:
   resource: redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384

redis-conf:
 proxy-upstream-tls-provider-class-name: com.netease.nim.camellia.redis.proxy.tls.upstream.DefaultProxyUpstreamTlsProvider

camellia-redis-proxy.properties

proxy.cluster.mode.nodes=127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384

proxy.frontend.tls.ca.cert.file=ca.pem
proxy.frontend.tls.ca.cert.file.path=/etc/redis/cert/ca.pem
proxy.frontend.tls.cert.file=redis.pem
proxy.frontend.tls.cert.file.path=/etc/redis/cert/redis.pem
proxy.frontend.tls.key.file=rediskey.pem
proxy.frontend.tls.key.file.path=/etc/redis/cert/rediskey.pem

proxy.upstream.tls.ca.cert.file=ca.pem
proxy.upstream.tls.ca.cert.file.path=/etc/redis/cert/ca.pem
proxy.upstream.tls.cert.file=client.pem
proxy.upstream.tls.cert.file.path=/etc/redis/cert/client.pem
proxy.upstream.tls.key.file=clientkey.pem
proxy.upstream.tls.key.file.path=/etc/redis/cert/clientkey.pem

proxy.upstream.tls.config=[{"resource":"redis-cluster://@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384","ca.cert.file.path":"/etc/redis/cert/ca.pem","cert.file.path":"/etc/redis/cert/client.pem","key.file.path":"/etc/redis/cert/clientkey.pem"}]

Looking forward for any hint, @caojiajun with thanks.

Zakaria.

caojiajun commented 1 year ago

you should config upstream resource in rediss-cluster://xxx instead of redis-cluster://xxx

https://github.com/netease-im/camellia/blob/master/docs/redis-proxy/auth/redis-resources.md

https://github.com/netease-im/camellia/blob/master/camellia-redis-base/src/main/java/com/netease/nim/camellia/redis/base/resource/RedisType.java

caojiajun commented 1 year ago

if client access proxy as a standalone redis:

this is frontend: cluster-mode-enable:true means multi proxy nodes disguised as a redis cluster proxy.cluster.mode.nodes=xxx means the proxy nodes list to proxy discovery each other. tls-port means client access proxy in tls connect proxy-frontend-tls-provider-class-name means the frontend tls provider proxy.frontend.tls.xxxxxx configs means the frontend tls config

this is upstream/backend:

InputOutputZ commented 1 year ago

if client access proxy as a standalone redis:

  • cluster-mode-enable should setting false
  • proxy.cluster.mode.nodes=xxx should delete in config

this is frontend: cluster-mode-enable:true means multi proxy nodes disguised as a redis cluster proxy.cluster.mode.nodes=xxx means the proxy nodes list to proxy discovery each other. tls-port means client access proxy in tls connect proxy-frontend-tls-provider-class-name means the frontend tls provider proxy.frontend.tls.xxxxxx configs means the frontend tls config

this is upstream/backend:

  • resource define the upstream redis addr, support redis:// redis-sentinel:// redis-cluster:// and rediss:// rediss-sentinel:// rediss-cluster://
  • proxy-upstream-tls-provider-class-name means the provider of upstream tls
  • proxy.upstream.tls.xxxx means the config of upstream tls

Hi caojiajun,

Thanks so much for clarifying it, finally I got it working. Just in case anyone else wondered how here is my working configuration with typical 6 nodes Redis Cluster establishing successful connection using TLS.

application.yml

server:
  port: 7619
spring:
  application:
    name: camellia-redis-proxy-server

camellia-redis-proxy:
 cluster-mode-enable: false
 cport: -1
 tls-port: 7619
 console-port: 0
 monitor-enable: false
 netty-transport-mode: epoll
 proxy-dynamic-conf-loader-class-name: com.netease.nim.camellia.redis.proxy.conf.FileBasedProxyDynamicConfLoader
 proxy-frontend-tls-provider-class-name: com.netease.nim.camellia.redis.proxy.tls.frontend.DefaultProxyFrontendTlsProvider
 password: mypassword
 username: default
 transpond:
  local:
   resource: rediss-cluster://default:mypassword@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384

redis-conf:
 proxy-upstream-tls-provider-class-name: com.netease.nim.camellia.redis.proxy.tls.upstream.DefaultProxyUpstreamTlsProvider

camellia-redis-proxy.properties

proxy.frontend.tls.ca.cert.file.path=/etc/redis/cert/ca.pem
proxy.frontend.tls.cert.file.path=/etc/redis/cert/redis.pem
proxy.frontend.tls.key.file.path=/etc/redis/cert/rediskey.pem

proxy.upstream.tls.ca.cert.file.path=/etc/redis/cert/ca.pem
proxy.upstream.tls.cert.file.path=/etc/redis/cert/redis.pem
proxy.upstream.tls.key.file=/etc/redis/cert/rediskey.pem

proxy.upstream.tls.config=[{"resource":"rediss-cluster://default:mypassword@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384","ca.cert.file.path":"/etc/redis/cert/ca.pem","cert.file.path":"/etc/redis/cert/redis.pem","key.file.path":"/etc/redis/cert/rediskey.pem"}]

@caojiajun btw predixy supports custom commands, and I was able to get client list command working and wonder if you have anything similar? as for now when I run client list I get " (error) syntax error "?

With thanks.

Zakaria.

caojiajun commented 1 year ago

https://redis.io/commands/client-list/ this command?

you want this command resp return the clients of proxy or clients of upstream redis?

caojiajun commented 1 year ago

your application.yml seems wrong indent, redis-conf is the child node of transpond

server:
  port: 7619
spring:
  application:
    name: camellia-redis-proxy-server

camellia-redis-proxy:
  password: mypassword
  tls-port: 7619
  proxy-frontend-tls-provider-class-name: com.netease.nim.camellia.redis.proxy.tls.frontend.DefaultProxyFrontendTlsProvider
  netty-transport-mode: epoll
  proxy-dynamic-conf-loader-class-name: com.netease.nim.camellia.redis.proxy.conf.FileBasedProxyDynamicConfLoader
  transpond:
    type: local
    local:
      type: simple
      resource: rediss-cluster://default:mypassword@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
    redis-conf:
      proxy-upstream-tls-provider-class-name: com.netease.nim.camellia.redis.proxy.tls.upstream.DefaultProxyUpstreamTlsProvider
InputOutputZ commented 1 year ago

https://redis.io/commands/client-list/ this command?

you want this command resp return the clients of proxy or clients of upstream redis?

Yes, I would love to have it?

caojiajun commented 1 year ago

clients of proxy or clients of upstream redis

which one?

InputOutputZ commented 1 year ago

clients of proxy or clients of upstream redis

which one?

Screenshot 2023-08-21 at 08 53 45

clients of upstream or proxy, can I get both of them?

caojiajun commented 1 year ago

clients of proxy or clients of upstream redis which one?

Screenshot 2023-08-21 at 08 53 45

clients of upstream or proxy, can I get both of them?

the reply fields of clients of proxy and clients of upstream redis is different, it's a problem.

caojiajun commented 1 year ago

client list return clients of upstream redis which passthrough the reply of redis define a new command proxy client list return clients of proxy

What do you think of this policy?

InputOutputZ commented 1 year ago

client list return clients of upstream redis which passthrough the reply of redis define a new command proxy client list return clients of proxy

What do you think of this policy?

I think it's better to return clients of proxy because it's more accurate, and so far to retrieve client ip addresses connected via proxy is only possible through full transparent proxying and it's not simple to achieve e.g. using haproxy and kernel full transparent modules, having I struggled to get it working.

Btw with that being said, not sure if my conclusion is correct, but I think the TLS implementation is not 100% correct. I set my Redis Cluster to require SSL client authentication, and I connect from my local machine to the cluster using the proxy, and it doesn't require client certificate but only CA file, while it does from the upstream i.e. cluster server?

Here is screenshot comparisons:-

Connection to cluster using upstream terminal, and it's working as it should.

Screenshot 2023-08-21 at 19 10 04

Connection to cluster using camellia proxy from my local machine, it should close connection unless valid client certificate was provided?

Screenshot 2023-08-21 at 19 09 55

I wonder if it could be something wrong in my configuration actually?

Anyways, again thanks for all your work.

caojiajun commented 1 year ago

you should setting no-tls-port to 0 to disabled it, no-tls-port priority higher than tls-port

server:
  port: 0
spring:
  application:
    name: camellia-redis-proxy-server

camellia-redis-proxy:
  password: mypassword
  tls-port: 7619
  proxy-frontend-tls-provider-class-name: com.netease.nim.camellia.redis.proxy.tls.frontend.DefaultProxyFrontendTlsProvider
  netty-transport-mode: epoll
  proxy-dynamic-conf-loader-class-name: com.netease.nim.camellia.redis.proxy.conf.FileBasedProxyDynamicConfLoader
  transpond:
    type: local
    local:
      type: simple
      resource: rediss-cluster://default:mypassword@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
    redis-conf:
      proxy-upstream-tls-provider-class-name: com.netease.nim.camellia.redis.proxy.tls.upstream.DefaultProxyUpstreamTlsProvider
caojiajun commented 1 year ago

if using haproxy before camellia-redis-proxy, from the perspective of proxy, client-ip is haproxy-ip rather than real client ip, unless camellia-redis-proxy support proxy-protocol, which currently not supported

caojiajun commented 1 year ago

132 camellia-redis-proxy supprt client list command to get proxy client info

131 camellia-redis-proxy support proxy_protocol to get real client ip in 4-layer-proxy

caojiajun commented 1 year ago

image

in v1.2.14, you can use info clients to get client connect num

caojiajun commented 1 year ago

you should setting no-tls-port to 0 to disabled it, no-tls-port priority higher than tls-port

server:
  port: 0
spring:
  application:
    name: camellia-redis-proxy-server

camellia-redis-proxy:
  password: mypassword
  tls-port: 7619
  proxy-frontend-tls-provider-class-name: com.netease.nim.camellia.redis.proxy.tls.frontend.DefaultProxyFrontendTlsProvider
  netty-transport-mode: epoll
  proxy-dynamic-conf-loader-class-name: com.netease.nim.camellia.redis.proxy.conf.FileBasedProxyDynamicConfLoader
  transpond:
    type: local
    local:
      type: simple
      resource: rediss-cluster://default:mypassword@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
    redis-conf:
      proxy-upstream-tls-provider-class-name: com.netease.nim.camellia.redis.proxy.tls.upstream.DefaultProxyUpstreamTlsProvider

my fault, it's a bug SSL bidirectional authentication not effective in 1.2.14 i will fix it in v1.2.15

InputOutputZ commented 1 year ago

you should setting no-tls-port to 0 to disabled it, no-tls-port priority higher than tls-port

server:
  port: 0
spring:
  application:
    name: camellia-redis-proxy-server

camellia-redis-proxy:
  password: mypassword
  tls-port: 7619
  proxy-frontend-tls-provider-class-name: com.netease.nim.camellia.redis.proxy.tls.frontend.DefaultProxyFrontendTlsProvider
  netty-transport-mode: epoll
  proxy-dynamic-conf-loader-class-name: com.netease.nim.camellia.redis.proxy.conf.FileBasedProxyDynamicConfLoader
  transpond:
    type: local
    local:
      type: simple
      resource: rediss-cluster://default:mypassword@127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
    redis-conf:
      proxy-upstream-tls-provider-class-name: com.netease.nim.camellia.redis.proxy.tls.upstream.DefaultProxyUpstreamTlsProvider

my fault, it's a bug SSL bidirectional authentication not effective in 1.2.14 i will fix it in v1.2.15

Perfect, if there is anything I can help with, please let me know.

Thanks so much for all your work and looking forward for a better Camellia Redis proxy.

caojiajun commented 1 year ago

the ssl bug has fixed in #133

131 #132

these two new features, could you pls create PR to support it?

InputOutputZ commented 1 year ago

Btw, I created this service to run the proxy server in RHEL7, and it works perfectly, it could be good idea to include it in the package quick start guide: https://github.com/netease-im/camellia/blob/master/docs/redis-proxy/quickstart/quick-start-package.md.

Configuring steps.

1- Move uncompressed camellia-redis-proxy-1.2.14.tar.gz to /root/camelliaRP 2- vi /etc/systemd/system/camellia_redisproxy.service 3-

[Unit]
Description=Camellia Redis Proxy service.
After=network-online.target
Wants=network-online.target

[Service]
SuccessExitStatus=143
Type=simple
WorkingDirectory=/root/camelliaRP
ExecStart=/usr/bin/java -XX:+UseG1GC -Xms4096m -Xmx4096m -server org.springframework.boot.loader.JarLauncher
ExecStop=/bin/kill -15 $MAINPID

KillMode=mixed

[Install]
WantedBy=multi-user.target

4- systemctl enable camellia_redisproxy.service --now

With thanks.

InputOutputZ commented 1 year ago

the ssl bug has fixed in #133

131 #132 these two new features, could you pls create PR to support it?

Perfect, I will test #133 fix and update you there but for #131 and #132 I don't think I'm qualified enough to work on a PR? but maybe I'm, not sure, while I'm sure I can help with testing for now, since I don't fully understand the codebase?

caojiajun commented 1 year ago

you can create a PR to add it to quick_start documents, thank you very much!

caojiajun commented 1 year ago

the ssl bug has fixed in #133

131 #132 these two new features, could you pls create PR to support it?

Perfect, I will test #133 fix and update you there but for #131 and #132 I don't think I'm qualified enough to work on a PR? but maybe I'm, not sure, while I'm sure I can help with testing for now, since I don't fully understand the codebase?

thank you for your testing!

InputOutputZ commented 1 year ago

you can create a PR to add it to quick_start documents, thank you very much!

I will do this just now, and btw I was trying to find way to compile package for 1.15 and I couldn't. I wonder which SDK do you use for this? would it be something like Eclipse and if there is any quick guide or would you recommend for me to wait until you release 1.15 package?

caojiajun commented 1 year ago

https://github.com/netease-im/camellia/blob/master/docs/redis-proxy/quickstart/build-snapshot-package.md

InputOutputZ commented 1 year ago

https://github.com/netease-im/camellia/blob/master/docs/redis-proxy/quickstart/build-snapshot-package.md

Perfect, thanks for this.