首页 > 代码库 > Xen主机动态调整CPU和内存
Xen主机动态调整CPU和内存
宿主机为24核cpu,64G内存,上面运行3台guest,因为业务的不确定性,不能提前确定多大性能服务器能够支持,所以开机为最小配置:4核 8G,以后随着业务增长动态调整CPU和内存
cat centos1
name = "centos1"
vcpus = 4
maxvcpus = 10
memory = 8192
maxmem = 24576
disk = [ "file:/var/xen/centos1.qcow2,"phy:/dev/sdc,xvdc,w"]
vif = [ "bridge=br0","bridge=br1" ]
on_reboot = "restart"
on_crash = "destroy"
修改内存:
xm mem-set centos1 16384 #调整centos1的内存为16G
xm mem-set centos1 24576 #调整centos1的内存为20G
修改cpu:
xm vcpu-list #查看cpu的使用
xm vcpu-set centos1 6 #修改centos1的cpu颗数
xm top #查看当前各主机的状态
快照,做快照需要关机
xm save centos1 centos1.save
xm shutdown centos1
xm restore centos1.save
本文出自 “金戈铁马行飞燕” 博客,请务必保留此出处http://bbotte.blog.51cto.com/6205307/1584951
Xen主机动态调整CPU和内存