前言
布置大数据环境,之前使用Xshell, 后来改为FinalXshell连接虚拟机,但是偶尔就会那么一下无法连接,咋连都连不上,有时候是一台机器出现问题,有时候三台一起出,但是大多数情况下都是直接重启虚拟机就好了。我就没太在意,今儿又出现三台机子都连不上这问题,下定决心一定要搞定他!
一、发现问题
首先经常重启机器就能好,每次重启重启的有网络服务这块儿,我就去查网络服务是否启动。
admin@master2 ~]$ systemctl status network.service
果然是这里出了问题
重启一次吧, 我不可以接受。
[admin@master2 ~]$ service network restart
Restarting network (via systemctl): Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
还是不行
二、查找日志文件
[admin@master2 ~]$ sudo cat /var/log/messages | grep network
Mar 6 13:35:54 master2 systemd: Starting LSB: Bring up/down networking...
Mar 6 13:35:54 master2 network: 正在打开环回接口: [ 确定 ]
Mar 6 13:35:54 master2 network: 正在打开接口 ens33: 错误:连接激活失败:****No suitable device found for this connection (device lo not available because device is strictly unmanaged).****
Mar 6 13:35:54 master2 network: [失败]
Mar 6 13:35:54 master2 network: RTNETLINK answers: File exists
Mar 6 13:35:54 master2 network: RTNETLINK answers: File exists
Mar 6 13:35:54 master2 network: RTNETLINK answers: File exists
Mar 6 13:35:54 master2 network: RTNETLINK answers: File exists
Mar 6 13:35:54 master2 network: RTNETLINK answers: File exists
Mar 6 13:35:54 master2 network: RTNETLINK answers: File exists
Mar 6 13:35:54 master2 network: RTNETLINK answers: File exists
Mar 6 13:35:54 master2 network: RTNETLINK answers: File exists
Mar 6 13:35:54 master2 network: RTNETLINK answers: File exists
Mar 6 13:35:54 master2 systemd: network.service: control process exited, code=exited status=1
Mar 6 13:35:54 master2 systemd: Failed to start LSB: Bring up/down networking.
Mar 6 13:35:54 master2 systemd: Unit network.service entered failed state.
Mar 6 13:35:54 master2 systemd: network.service failed.
No suitable device found for this connection (device lo not available because device is strictly unmanaged).
网卡出故障了, 全部重启一下。
分别执行如下代码重启NetworkManager
[admin@master2 ~]$ chkconfig NetworkManager off
[admin@master2 ~]$ sudo chkconfig network on
[admin@master2 ~]$ service NetworkManager stop
[admin@master2 ~]$ service network start
[admin@master2 ~]$ systemctl status network
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: active (exited) since 六 2021-03-06 14:16:14 CST; 10s ago
Docs: man:systemd-sysv-generator(8)
Process: 5314 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)
网络重启完成。其他两台slave1、slave2同理如此改。
Xshell和FinalXshell就都可以连接了。