Redis turns on Telnet connections.

Source: Internet
Author: User

Today, when using the Jedis client API to connect to Redis remotely, the error is as follows:

redis.clients.jedis.exceptions.JedisConnectionException: Java.net.ConnectException:Connection refused: Connect at Redis.clients.jedis.Connection.connect (Connection.java:164) at Redis.clients.jedis.BinaryClient.connect (Binaryclient.java:80) at Redis.clients.jedis.Connection.sendCommand (Connection.java:100) at Redis.clients.jedis.Connection.sendCommand (Connection.java:91) at Redis.clients.jedis.BinaryClient.auth (Binaryclient.java:551) at Redis.clients.jedis.BinaryJedis.auth (Binaryjedis.java:2047) at Sy.test.TestJedis.setUp (Testjedis.java:18) 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:47) at Org.junit.internal.runners.model.ReflectiveCallable.run (Reflectivecallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively (Frameworkmethod.java:44) at Org.junit.internal.runners.statements.RunBefores.evaluate (Runbefores.java:24) at Org.junit.internal.runners.statements.RunAfters.evaluate (Runafters.java:27) at Org.junit.runners.ParentRunner.runLeaf (Parentrunner.java:271) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (Blockjunit4classrunner.java:70) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (Blockjunit4classrunner.java:50) at org.junit.runners.parentrunner$3.run (parentrunner.java:238) at org.junit.runners.parentrunner$1.schedule (parentrunner.java:63) at Org.junit.runners.ParentRunner.runChildren (Parentrunner.java:236) at org.junit.runners.parentrunner.access$(parentrunner.java:53) at org.junit.runners.parentrunner$2.evaluate (parentrunner.java:229) at Org.junit.runners.ParentRunner.run (Parentrunner.java:309) 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.ConnectException:Connection refused:connect 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:158)    ... More

It turns out that Redis can only log on by default, so you need to turn on Telnet. Here's how to fix it:

In the Redis profile redis.conf, locate #bind localhost commented out.

Comment out the machine, all the computers within the LAN can access.

Band localhost can only be accessed natively, and the computer in the LAN cannot be accessed.

The bind LAN IP can only be accessed by the IP machine on the LAN and cannot be accessed by localhost.

Verification Method:

PS grep Redis Root       2175     1  0 : A .        xx:/usr/local/bin/redis-server * :6379

As you can see in/usr/local/bin/redis-server *:6379, all IP connections are allowed to log on to this Redis service.

Reference article:

1.http://www.oschina.net/question/579073_113004?fromerr=ybv8rryl

Redis turns on Telnet connections.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.