1.检查是否可以连接reids服务器的6379端口
image
telnet redis服务器ip 6379
2.查看reids服务启动情况
redis-cli -h localhost -p 6379 -a ping
返回PONG表示处于启动状态
3.netstat -tnlp查看reids进程和端口是否存在。ip地址是否为0.0.0.0。如果ip地址是127.0.0.1,则只是本机能使用,所以其他ip连接失败。
image
4.修改redis.conf文件

  • 查找配置文件位置,执行find / -name redis.conf
  • 查找bind所在行cat /usr/local/redis/redis.conf|grep bin -n
  • 编辑配置文件vim /usr/local/redis/redis.conf
  • 修改bind 127.0.0.1为bind 0.0.0.0
    5.重启redis服务
    systemctl restart redis./redis-server /usr/local/redis/redis.conf