The previous article describes the installation of KVM virtual machines and Virsh related commands on CentOS 6, and here's how to get a virtual machine from a remote management node, or log on to the Virsh command line on a remote server.
2 main units:
node4:192.168.1.166
node5:192.168.1.143
Node4 as a remote Libvirt server with virtual machines already created, the virtual machines on the remote server are now managed on NODE5 in the following 2 ways:
by Qemu+ssh Way
by Qemu+tcp Way
Install Libvirt and related kits on NODE5, and I've installed these here,
#yum Groupinstall "Virtualization" #yum install Libvirt Libvirt-python python-virtinst virt-viewer
Through Qemu+ssh connection method is relatively simple, just NODE5 can use SSH remote access node4 can,
The command is as follows:
#virsh-C Qemu+ssh://[email Protected]/system
If 2 nodes set up mutual trust, key-free login, can directly execute Virsh related commands,
[[email protected] ~]# virsh-c qemu+ssh://[email protected]/system list Id name status-------------- --------------------------------------3 VM01 Running
The following describes the Virsh for logging on to a remote node by qemu+tcp:
Node4 on
To modify/ETC/SYSCONFIG/LIBVIRTD, turn on the following 2 configuration items:
[Email protected] ~]# egrep-v "^#|^$"/etc/sysconfig/libvirtdlibvirtd_config=/etc/libvirt/libvirtd.conflibvirtd_ Args= "--listen
Modify the configuration file,
Vim/etc/libvirt/libvirtd.conflisten_tls = 0listen_tcp = 1tcp_port = "16509" listen_addr = "0.0.0.0" auth_tcp = "None"
Restart the LIBVIRTD and view the monitored ports.
#/ETC/INIT.D/LIBVIRTD restart# netstat-anltp|grep 16509tcp 0 0 0.0.0.0:16509 0.0.0.0:* LISTEN 28843/ Libvirtd
Remote access on NODE5 (you need to make sure that you can access the NODE4 16509 TCP port):
[[email protected] ~]# virsh-c qemu+tcp://192.168.1.166/system list Id name status------------------ ----------------------------------3 VM01 Running
Remote management of virtual machines via Libvirt