idea整合redis报错io.netty.channel.ConnectTimeoutException: connection timed out
原因分析:
这个问题有很大的可能是Linux的防火墙未关闭,请求无法到达redis客户端。
如果想要外部访问redis前提是把redis配置文件中的 protected-mode yes,改为 protected-mode no 这样redis才允许外部访问
1.使用命令查看防火墙是否关闭
查看Linux防火墙状态命令:systemctl status firewalld.service
[root@iZwz95p6ra1evt2xcc42ymZ bin]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2021-04-21 01:13:20 CST; 1 weeks 3 days ago
Docs: man:firewalld(1)
Main PID: 1472 (firewalld)
CGroup: /system.slice/firewalld.service
└─1472 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid
Apr 21 01:13:19 iZwz95p6ra1evt2xcc42ymZ systemd[1]: Starting firewalld - dynamic firewall daemon...
Apr 21 01:13:20 iZwz95p6ra1evt2xcc42ymZ systemd[1]: Started firewalld - dynamic firewall daemon.
Apr 21 01:13:20 iZwz95p6ra1evt2xcc42ymZ firewalld[1472]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in...ng it now.
Hint: Some lines were ellipsized, use -l to show in full.
如上出现running(第四行,第三单词)表示防火墙未关闭
2.使用命令关闭防火强:systemctl stop firewalld.service
再次查看Linux防火墙状态命令:systemctl status firewalld.service
会发现变成这样
[root@iZwz95p6ra1evt2xcc42ymZ bin]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
Apr 21 01:13:19 iZwz95p6ra1evt2xcc42ymZ systemd[1]: Starting firewalld - dynamic firewall daemon...
Apr 21 01:13:20 iZwz95p6ra1evt2xcc42ymZ systemd[1]: Started firewalld - dynamic firewall daemon.
Apr 21 01:13:20 iZwz95p6ra1evt2xcc42ymZ firewalld[1472]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in...ng it now.
May 01 17:25:37 iZwz95p6ra1evt2xcc42ymZ systemd[1]: Stopping firewalld - dynamic firewall daemon...
May 01 17:25:37 iZwz95p6ra1evt2xcc42ymZ systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.
如上出现dead(第四行,第三单词)表示防火墙已经关闭
再次尝试访问就不会报错了噢