remote工作环境¶
远程环境启动流程
1.服务器已经设置为通电自启,服务器开关使用智能插座实现。
从服务器上电到ESXi完全启动此步骤耗时约8分钟。
2.服务器自动启动后需要使用远程方式连接到ESXi命令行界面
T420的zerotier地址是10.242.1.81;通过ssh登录到T420设备上。
远程登录到T420设备上再通过ssh登录到ESXi命令行界面。
1.退出ESXi的维护模式
2.启动虚拟机
查看vim-cmd vmsvc 支持的命令集
[root@localhost:~] vim-cmd vmsvc help
Commands available under vmsvc/:
acquiremksticket get.snapshotinfo
acquireticket get.spaceNeededForConsolidation
createdummyvm get.summary
destroy get.tasklist
device.connection getallvms
device.connusbdev gethostconstraints
device.ctlradd message
device.ctlrremove power.getstate
device.disconnusbdev power.hibernate
device.diskadd power.off
device.diskaddexisting power.on
device.diskextend power.reboot
device.diskremove power.reset
device.getdevices power.shutdown
device.nvdimmadd power.suspend
device.nvdimmremove power.suspendResume
device.toolsSyncSet queryftcompat
devices.createnic reload
get.capability setscreenres
get.config snapshot.create
get.config.cpuidmask snapshot.dumpoption
get.configoption snapshot.get
get.datastores snapshot.remove
get.disabledmethods snapshot.removeall
get.environment snapshot.revert
get.filelayout snapshot.setoption
get.filelayoutex tools.cancelinstall
get.guest tools.install
get.guestheartbeatStatus tools.upgrade
get.managedentitystatus unregister
get.networks upgrade
get.runtime
在ESXi界面查看ESXi上所有的虚拟机vim-cmd vmsvc/getallvms
[root@localhost:~] vim-cmd vmsvc/getallvms
Vmid Name File Guest OS Version Annotation
13 centos7 [storage] centos7/centos7.vmx centos7_64Guest vmx-20 passwd: ....
26 server_jump [storage] server_jump/server_jump.vmx windows2019srv_64Guest vmx-20
27 jumpserver [storage] jumpserver_1/jumpserver_1.vmx ubuntu64Guest vmx-20
28 rocky8 [storage] rocky8/rocky8.vmx rockylinux_64Guest vmx-20
29 rocky9 [storage] rocky9/rocky9.vmx rockylinux_64Guest vmx-20
通过vmid启动虚拟机jumperserver;和server_jump(windows远程服务器)
通过浏览器远程登录jumpserver地址10.242.251.251
作为所有虚拟机的统一入口
关闭远程环境环境
通过ESXi命令行关闭ESXi上的虚拟机;试用命令关闭虚拟机需要先在虚拟机上安装tools
[root@localhost:~] vim-cmd vmsvc/power.off 26
Powering off VM:
[root@localhost:~] vim-cmd vmsvc/power.off 27
Powering off VM:
进入维护模式
命令行关闭EXSi主机
ESXi处于维护模式;使用命令esxcli system shutdown poweroff -r "off"
关闭ESXi主机,等待一会儿服务器自动下电。
[root@localhost:~] esxcli system shutdown poweroff -r "off"
[root@localhost:~] Connection to 192.168.3.199 closed by remote host.
Connection to 192.168.3.199 closed.
h@T420:~$
强制关闭没有安装vmtools的虚拟机
2107685 2107685 vmx
2107693 2107685 vmx-vthread-210
2107694 2107685 vmx-filtPoll:EulerOS_temp
2107695 2107685 vmx-mks:EulerOS_temp
2107696 2107685 vmx-svga:EulerOS_temp
2107697 2107685 vmx-vcpu-0:EulerOS_temp
2107699 2107685 vmx-vcpu-1:EulerOS_temp
2107700 2107685 vmx-vcpu-2:EulerOS_temp
2107701 2107685 vmx-vcpu-3:EulerOS_temp
[root@localhost:~] kill -9 2107685
智能插座断电