Cannot connect to redis using jedis

前端 未结 1 1873
无人及你
无人及你 2021-01-05 03:41

Redis version: 3.2.0 Jedis version: 2.8.1

Below is my java code for connecting to redis:

public class TestRedis {
public static void main(String[] ar         


        
相关标签:
1条回答
  • 2021-01-05 04:33

    There are a few settings that would affect this: bind and protected-mode. They work together to provide a baseline of security with new installs.

    Find the following in your redis.conf file and comment it out:

    bind 127.0.0.1
    

    By adding a # in front of it:

    # bind 127.0.0.1
    

    Or, if you would rather not comment it out, you can also add the IP of your eth0/em1 interface to it, like this:

    bind 127.0.0.1 192.168.1.57
    

    Also, unless you're using password security, you'll also have to turn off protected mode by changing:

    protected-mode yes
    

    To:

    protected-mode no
    

    Make sure that you read the relevant documentation and understand the security implications of both of these changes.

    After making these changes, restart redis.

    0 讨论(0)
提交回复
热议问题