problem Description: My Redis is installed on the CENTOS7 operating system of the virtual machine, but running my Windows write Jedis program has always reported the connection timeout, I try to add connection time in Jedis, but has been no effect, really tortured me all day.
Redis.clients.jedis.exceptions.JedisConnectionException:java.net.SocketTimeoutException:connect timed out at Redis.clients.jedis.Connection.connect (connection.java:155) at Redis.clients.jedis.BinaryClient.connect ( binaryclient.java:83) at Redis.clients.jedis.Connection.sendCommand (connection.java:94) at Redis.clients.jedis.BinaryClient.set (binaryclient.java:100) at Redis.clients.jedis.Client.set (client.java:29) at Redis.clients.jedis.Jedis.set (jedis.java:65) at Test. Jedistest.testjedissingle (jedistest.java:19) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (method.java:606) at Org.junit.runners.model.frameworkmethod$1.runreflectivecall (
FRAMEWORKMETHOD.JAVA:50) at Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:12) At Org.juNit.runners.model.FrameworkMethod.invokeExplosively (frameworkmethod.java:47) at Org.junit.internal.runners.statements.InvokeMethod.evaluate (invokemethod.java:17) at Org.junit.runners.ParentRunner.runLeaf (parentrunner.java:325) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:78) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:57) at Org.junit.runners.parentrunner$3.run (parentrunner.java:290) at Org.junit.runners.parentrunner$1.schedule ( parentrunner.java:71) at Org.junit.runners.ParentRunner.runChildren (parentrunner.java:288) at org.junit.runners.parentrunner.access$000 (parentrunner.java:58) at Org.junit.runners.parentrunner$2.evaluate ( parentrunner.java:268) at Org.junit.runners.ParentRunner.run (parentrunner.java:363) at Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUNIT4TESTREFERENCE.JAVA:50) at Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38) at ORG.ECLIPSE.JDT. Internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:467) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:683) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:390) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:197) 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:339) at Java.net.AbstractPlainSocketImpl.connectToAddress (abstractplainsocketimpl.java:200) at Java.net.AbstractPlainSocketImpl.connect (abstractplainsocketimpl.java:182) at Java.net.PlainSocketImpl.connect ( plainsocketimpl.java:172) at Java.net.SocksSocketImpl.connect (sockssocketimpl.java:392) at Java.net.Socket.connect (socket.java:579) at REDIS.CLIEnts.jedis.Connection.connect (connection.java:149) ...
More
workaround: Shut down the CentOS firewall