The Redis host cannot access the problem with Linux (Centos6.9) installed

Source: Internet
Author: User

Solve this problem is not easy ah, say all is tears, baby Heart bitter!!!

Here are the steps to resolve:

1. Comment out bind 127.0.0.1

Because the configuration file binds to the local IP, this configuration causes the other IP access to be denied, so we comment it out

2. Change protected-mode Yes to Protected-mode no

Because Redis runs in protected mode by default (in this mode, Access does not require a password), this mode only allows local loop access

3. After you have done 2, you need to set the Redis code:requirepass xxx(password)

4. Turn off the firewall:service iptables Stop(this method only temporarily shuts down the fire wall, the next boot system will be invalidated, the Redis port can be added to the firewall rules, in particular, to query the firewall related knowledge)

5. Restart the Redis service, but you will need to specify a specific file:./redis-server. /redis.conf

After all 5 points have been completed, running the code in the console should be successful:

New Jedis ("193.168.1.106", 6379); Jedis.auth ("xxx"); System.out.println ("Connection succeeded"// Check whether the service is running System.out.println ("service is running:" +jedis.ping ());

Operation Result:

Connection Successful
Service is running: PONG

Finish!

Hope to meet this problem of friends have help, thank you!

The Redis host cannot access the problem under

Linux (Centos6.9)

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.