Proxmox VE 6.1从零带你了解之--Cluster和HA的配置与管理
Proxmox的Cluster建立
pve:(172.20.9.50)
root@pve:~# pvecm create test
pve02:(172.20.9.53)
root@pve02:~# pvecm add 172.20.9.50
pve:(172.20.9.54)
root@pve03:~#pvecm add 172.20.9.50
三条命令成功执行完后,登录任意一个IP就可以管理Cluster了.
Promox的HA配置
DataCenter(test)-->HA
第一步,创建HA的Groups
DataCenter(test)-->HA-->Groups-->Create
这里可以有很多选项,我们就选择最最常用的。
DataCenter(test)-->HA-->Add
按照VM 100加入HA的情况,把其他所有机器都加入HA
特别需要注意的是Request State: 如果不需要开机的,选择stopped。
状态还有ignored和disabled两类状态。
如果觉得麻烦,可以命令行。
root@pve:~# ha-manager status
quorum OK
master pve03 (active, Sun Mar 15 20:37:20 2020)
lrm pve (active, Sun Mar 15 20:37:15 2020)
lrm pve02 (active, Sun Mar 15 20:37:17 2020)
lrm pve03 (active, Sun Mar 15 20:37:16 2020)
service vm:100 (pve02, error)
service vm:101 (pve, started)
service vm:102 (pve, started)
service vm:103 (pve02, started)
service vm:105 (pve03, started)
service vm:109 (pve02, not found)
root@pve:~# ha-manager remove vm:101
root@pve:~# ha-manager add vm:101 --group HA_Group
root@pve:~# ha-manager status
quorum OK
master pve03 (active, Sun Mar 15 20:38:00 2020)
lrm pve (active, Sun Mar 15 20:37:54 2020)
lrm pve02 (active, Sun Mar 15 20:37:57 2020)
lrm pve03 (active, Sun Mar 15 20:37:56 2020)
service vm:100 (pve02, error)
service vm:101 (pve, starting)
service vm:102 (pve, started)
service vm:103 (pve02, started)
service vm:105 (pve03, started)
service vm:109 (pve02, not found)
root@pve:~#
切换测试
Proxmox触发条件了解一下
1.服务器手动重启,所有VM不迁移,VM状态全为freeze等待宿主机起来后启动。
2.服务器手动关机,所有VM不迁移,VM状态全为freeze等待宿主机起来后启动。
3.服务器异常中断,如断网,服务器突然断电等异常情况,理论上VM会迁移到其他正常运行的主机上。
切换测试一,pve主机重启
五台运行的VM,一台模板机都在pve上
确保所有VM在HA的状态正常.
重启pve主机
登录pve03查看Cluster状态
查看HA状态--所有VM都是freeze状态
等服务器重启完成,所有VM都会在pve主机上重新运行
切换测试二,pve主机关机
效果和切换测试一相同,就不贴图了。
切换测试三,关闭pve主机的交换机端口
测试的所有主机和VM状态如下
关掉交换机端口
Monitor-Room-2960S#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Monitor-Room-2960S(config)#inter
Monitor-Room-2960S(config)#interface gi
Monitor-Room-2960S(config)#interface gigabitEthernet 1/0/19
Monitor-Room-2960S(config-if)#shut
Monitor-Room-2960S(config-if)#
网络中断
查看Cluster状态
查看HA状态
VM 状态变为fence
VM开始迁移
六个主机,每台主机三个VM,还不错。
迁移状态变更时间大约2分多钟,全部切换应该是在3分钟左右。
SSH通信问题解决方案
task started by HA resource agent
2020-03-15 20:56:35 # /usr/bin/ssh -e none -o 'BatchMode=yes' -o 'HostKeyAlias=pve03' root@172.20.9.54 /bin/true
2020-03-15 20:56:35 Host key verification failed.
2020-03-15 20:56:35 ERROR: migration aborted (duration 00:00:00): Can't connect to destination address using public key
TASK ERROR: migration aborted
处理方式:
root@pve:~# /usr/bin/ssh -e none -o 'HostKeyAlias=pve03' root@172.20.9.54 /bin/true
The authenticity of host 'pve03 (172.20.9.54)' can't be established.
ECDSA key fingerprint is SHA256:/bAsG9C0Mw52KTxtfyE6RYON1mLosD9mu03Mb8M0E74.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'pve03' (ECDSA) to the list of known hosts.
root@pve:~# ssh 172.20.9.54
Linux pve03 5.3.10-1-pve #1 SMP PVE 5.3.10-1 (Thu, 14 Nov 2019 10:43:13 +0100) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Mar 15 21:08:06 2020 from 172.20.9.50
root@pve03:~# exit
logout
Connection to 172.20.9.54 closed.
root@pve:~#
来源:51CTO
作者:wild_li01
链接:https://blog.51cto.com/5404628/2478709