NutzCN Logo
问答 redis集群无法连接
发布于 2033天前 作者 xinerivg 2631 次浏览 复制 上一个帖子 下一个帖子
标签:

配置文件里配的地址是集群中的一个节点,项目的具体代码和集群应该是对的因为在别的机器上可以成功启动并访问。。。这台机器上用可视化工具是可以连接的,但是项目连接不上,怎么看都像网络问题,但是ping telnet都通,可视化工具也能连上,救救孩子。。。

 org.nutz.mvc.LoadingException: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
	at org.nutz.mvc.LoadingException$FC$9a86caf9ff5d3b587784fcdf555a4a7d.invoke(LoadingException.java)
	at org.nutz.lang.born.AbstractConstructorBorning.call(AbstractConstructorBorning.java:25)
	at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:19)
	at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
	at org.nutz.lang.Mirror.born(Mirror.java:990)
	at org.nutz.lang.Lang.wrapThrow(Lang.java:200)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:135)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4590)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5233)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1144)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1878)
	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:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
	at redis.clients.util.Pool.getResource(Pool.java:53)
	at redis.clients.jedis.JedisPool.getResource(JedisPool.java:226)
	at redis.clients.jedis.JedisSlotBasedConnectionHandler.getConnectionFromSlot(JedisSlotBasedConnectionHandler.java:66)
	at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:116)
	at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:141)
	at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:141)
	at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:141)
	at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:141)
	at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:141)
	at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:141)
	at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:141)
	at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:141)
	at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:141)
	at redis.clients.jedis.JedisClusterCommand.run(JedisClusterCommand.java:31)
	at redis.clients.jedis.JedisCluster.set(JedisCluster.java:103)
	at org.nutz.integration.jedis.JedisClusterWrapper.set(JedisClusterWrapper.java:99)
	at com.wonders.redis.at.RedisAt.loadAllQstb(RedisAt.java:56)
	at com.wonders.redis.at.RedisAt$$NUTZAOP._aop_invoke(RedisAt.java:4)
	at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
	at org.nutz.integration.jedis.RedisInterceptor.filter(RedisInterceptor.java:24)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at com.wonders.redis.at.RedisAt$$NUTZAOP.loadAllQstb(RedisAt.java:1)
	at com.wonders.MainSetup.init(MainSetup.java:16)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:274)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
	... 19 more
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: connect timed out
	at redis.clients.jedis.Connection.connect(Connection.java:207)
	at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:93)
	at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1767)
	at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:106)
	at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:868)
	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435)
	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
	at redis.clients.util.Pool.getResource(Pool.java:49)
	... 44 more
Caused by: java.net.SocketTimeoutException: connect timed out
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at redis.clients.jedis.Connection.connect(Connection.java:184)
	... 51 more
8 回复

在项目所在的机器, 用redis-cli是否能连接

D:\redis>redis-cli -h 192.168.68.10 -p 6380
192.168.68.10:6380> ping
PONG

通的T T

在MainSetup里面打印一下配置信息,看看配置对不对

19-04-22 22:39:35.782 ERROR [localhost-startStop-1] redis.host:192.168.68.10
19-04-22 22:39:35.797 ERROR [localhost-startStop-1] redis.port:6380
19-04-22 22:39:35.797 ERROR [localhost-startStop-1] redis.mode:cluster

这样咩?配置文件里读了下host port 和mode

就这一个tomcat连不了? 下载个新的试试?

如果redis集群中只有这一个可连接节点,会造成这种问题吗(其他节点因为网络问题,与这个客户端是不通的,策略只开了这一个节点的端口)

... 那得挂

十分感谢,刚刚想到这个。。。一直想着节点之间互相联通,客户端只要连接一个节点就可以-_-||

添加回复
请先登陆
回到顶部