Remote cannot connect to Redis

1. Check whether the network port is open

    Open the command line and enter: telnet 192.168.1.106 6379

    (If it returns "telnet is not an internal or external command", see: What to do if telnet is not an internal or external command )

     If it is found that the port is not open:

     a. Open the port method in CentOS 7.x:

          ~:# firewall-cmd --query-port=6379/tcp

          ~:# firewall-cmd --add-port=6379/tcp

          ~:# firewall-cmd --query-port=6379/tcp

      b. Open the port method in CentOs 6.x:

          ~:# /sbin/iptables -I INPUT -p tcp --dport 6379 -j DROP    write modification

          ~:# /etc/init.d/iptables save    save changes

          ~:# service iptables restart    restart the firewall, the modification will take effect

2. Open the "redis installation directory/redis.conf" file,

       a. Find the line "bind 127.0.0.1" and comment it with #

       b. Find the line "# requirepass", remove the # comment, and add the password you set

3. Restart redis

        ~:# src/redis-server redis.conf

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326484549&siteId=291194637