NoOps

Ops make no ops | Ops的目标是没有Ops,嗯!

centos kvm部署和常用命令

作者: |   1,561 浏览  | 

1.安装kvm libvirt环境

yum -y install qemu* yum -y install libvirt* yum install -y kvm kmod-kvm kvm-qemu-img libvirt python-virtinst virt-manager virt-viewer bridge-utils yum -y install avahi

/etc/init.d/messagebus restart

/etc/init.d/avahi-daemon restart /etc/init.d/libvirtd restart /sbin/chkconfig messagebus on /sbin/chkconfig avahi-daemon on

service libvirtd start

chkconfig libvirtd on

2.常用命令

生成kvm虚拟机:virt-install

查看在运行的虚拟机:virsh list

查看所有虚拟机:virsh list –all

查看kvm虚拟机配置文件:virsh dumpxml name

启动kvm虚拟机:virsh start name

停止:virsh destroy name

删除:virsh undefine name

根据配置文件定义虚拟机:virsh define file-name.xml

console虚拟机:virsh console name

3.其他

kvm虚拟机常常搭配lvm使用,查看虚拟机经常使用vnc

需要确保cpu打开vt支持,cat /proc/cpuinfo可以看到

虚拟机内核总数不超过物理机内核的2倍

虚拟机内粗总和不超过物理机实际内存

4 Comments

  1. nexpro
    2013/05/09 at 10:02 上午

    请教一下”虚拟机内核总数不超过物理机内核的2倍” 这样做的依据是什么?

    • siyu
      2013/05/09 at 10:25 上午

      这个依据虽然没有自己测试,但是是之前公司的专门虚拟化测试组长期测试得出的结论。
      谢谢

  2. qipeng
    2013/05/09 at 11:56 上午

    内核数的2倍, 比如我有两颗e5-2650
    processor : 31
    vendor_id : GenuineIntel
    cpu family : 6
    model : 45
    model name : Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
    stepping : 7
    cpu MHz : 2000.060
    cache size : 20480 KB
    physical id : 1
    siblings : 16
    core id : 7
    cpu cores : 8

    我开的虚拟机最多64个核?

    • siyu
      2013/05/09 at 11:57 上午

      是的~~
      我们也是算开VT情况下的核数为物理机的核数。

发表评论