[原]一些KVM测试过程中的命令笔记(2)分配实例
一.為其他組分配instances:
1.進入192.168.77.51
2.如下操作:
查看images:
euca-describe-images
查看類型;
sudo nova-manage flavor list
選擇類型并啟動instances:
euca-run-instances ami-00000014 -t m1.hcType
獲取地址:
euca-allocate-address
分配地址:
euca-associate-address -i? i-000000c8 192.168.77.241
查看instance:
euca-describe-instances | grep 192.168.77.241
進入所在computer,查看VNC端口
ps -ef|grep instances | grep c8
VNC進入,修改防火墻和遠程鏈接,重啟instances:
euca-reboot-instances i-000000c8
------------------------------------------------
上傳模板:
glance add name="foranybackup" is_public=true < /home/testcloud/win-2003-x86_64.img --host=192.168.77.109
------------------------------------------------
卷相關(guān):
sudo pvs
sudo vgs
sudo lvs
euca-describe-volumes
euca-attach-volume -i i-00000081 -d /dev/vdc vol-00000017
------------------------------------------------
自定義instance類型:
sudo nova-manage flavor create --name=m1.Hao500G --memory=8192 --cpu=8 --local_gb=500 --flavor=16 --swap=0 --rxtx_quota=0 --rxtx_cap=0
sudo nova-manage flavor create --name=m1.hcXCF --memory=4096 --cpu=2 --local_gb=50 --flavor=20 --swap=0 --rxtx_quota=0 --rxtx_cap=0
------------------------------------------------
直接使用img啟動虛擬機:
創(chuàng)建鏡像:sudo kvm-img create -f qcow2 RHEL6_x86_64.img 20G
sudo kvm -m 2048 -cdrom rhel-server-6.0-x86_64-dvd.iso -drive file=RHEL6_x86_64.img,if=virtio,index=0,boot=on -boot d -net nic -net user -nographic -vnc :25
sudo kvm -m 2048 -drive file=***.img -boot c -usbdevice tablet -nographic -vnc :*
------------------------------------------------
指定compute節(jié)點所在機器
nova-manange service disable dev-compute* nova-compute
------------------------------------------------
多節(jié)點出現(xiàn)問題時候解決辦法:(重裝nova-computer服務(wù))
sudo apt-get autoremove nova-compute
sudo apt-get install -y? nova-compute
virsh list
sudo service nova-compute restart
sudo service nova-compute start
sudo service nova-compute restart
virsh list
sudo apt-get autoremove nova-compute
sudo apt-get install -y nova-compute
euca-describe-availability-zones verbose
virsh list
----------------------------------------------
sudo kvm -m 2048 -drive file=win-2003-x86_64.img -boot c -usbdevice tablet -nographic -vnc :65
euca-attach-volume -i i-000000f0 -d? /dev/vdc vol-00000025
----------------------------------------------
配置網(wǎng)橋
?brctl addbr br0
?brctl addif br0 eth0
增加網(wǎng)橋:
ifconfig eth0 0.0.0.0 up
ifconfig eth1 0.0.0.0 up
ifconfig eth0 0.0.0.0 promisc
ifconfig eth1 0.0.0.0 promisc
brctl addif br0 eth0 eth1
brctl show
ifconfig br0 10.10.1.1 netmask 255.255.0.0 up
刪除網(wǎng)橋接口:
brctl delif? br0 eth0 eth1
刪除網(wǎng)橋:
brctl delbr? br0
關(guān)閉生成樹:
brctl stp br0 off
----------------------------------------------
1、創(chuàng)建網(wǎng)橋設(shè)備 br0:? brctl addbr br0
2、向br0中添加網(wǎng)卡 eth0? eth1
brctl addif eth0
brctl addif eth1
3、從網(wǎng)橋中刪除網(wǎng)卡 eth0 eth1
brctl delif eth0
brctl delif eth1
4、刪除網(wǎng)橋 br0 :
brctl? delbr? br0
在網(wǎng)橋上設(shè)置ip地址的命令:
ifconfig? br0 xxx.xxx.xx.xxx? netmask? 255.255.xxx.xxx?? broadcast xxx.xxx.xx.xx
----------------------------------------------
添加磁盤:
1. 硬件
2. sudo fdisk -l
3. fdisk /dev/sdb?? ??? ??? ??? ??? ?(對新添加的硬盤(裸盤)做格式化:)
3. pvcreate /dev/sdc1?? ??? ??? ?(?? ?建PV?? ?前一步fdisk -l的設(shè)備名)
4. vgcreate vg_compute7RHEL6 /dev/sdb4 (建vg,前者為vg名,后者為設(shè)備名)
?? ?vgextend vg_compute3rhel6 /dev/sdc1?? ?(建vg?? ?vg名 卷名)
5. 創(chuàng)建lv:
[root@compute7RHEL6 testcloud]# vgdisplay vg_compute7RHEL6 | grep "Total PE"
? Total PE????????????? 119102
[root@compute7RHEL6 testcloud]# lvcreate -l 119102 vg_compute7RHEL6 -n lv1_hc
? Logical volume "lv1_hc" created
6. lvextend /dev/mapper/vg_compute3rhel6-LogVol01 /dev/sdc1?? ?(分區(qū)名[由df-lh得出]?? ?卷名)
附:幫助信息:
[root@compute7RHEL6 testcloud]# vgcreate --help
? vgcreate: Create a volume group
vgcreate
?? ?[-A|--autobackup {y|n}]
?? ?[--addtag Tag]
?? ?[--alloc AllocationPolicy]
?? ?[-c|--clustered {y|n}]
?? ?[-d|--debug]
?? ?[-h|--help]
?? ?[-l|--maxlogicalvolumes MaxLogicalVolumes]
?? ?[-M|--metadatatype 1|2]
?? ?[--[vg]metadatacopies #copies]
?? ?[-p|--maxphysicalvolumes MaxPhysicalVolumes]
?? ?[-s|--physicalextentsize PhysicalExtentSize[bBsSkKmMgGtTpPeE]]
?? ?[-t|--test]
?? ?[-v|--verbose]
?? ?[--version]
?? ?[ PHYSICAL DEVICE OPTIONS ]
?? ?VolumeGroupName PhysicalDevicePath [PhysicalDevicePath...]
?
?
?
kvm --version
uname -a
cat /etc/lsb-release
euca-describe-instances | grep computer4
euca-describe-instances | grep compute4
euca-describe-instances | grep 10.0.2.149
ll
source creds/novarc
sudo pvs
euca-create-volume
euca-create-volume --help
euca-create-volume -z nova -s 500g
euca-create-volume -z nova -s 500
euca-describe-volumes vol-00000026
su
euca-describe-volumes
source kvm/novarc
euca-create-volume -z nova -s 500
euca-describe-volumes vol-00000027
euca-create-volume -z nova -s 500g
euca-create-volume -z nova -s 500
euca-describe-volumes
su
sudo service nova-volume restart
euca-describe-volumes
euca-create-volume -z nova -s 50
euca-describe-volumes
euca-create-volume -z nova -s 50
euca-describe-volumes
euca-create-volume -z nova -s 500
euca-describe-volumes
euca-describe-images
euca-describe-volumes
sudo nova-manage flavor list
euca-run-instances ami-00000014 -t m1.Hao500G
euca-describe-instances | grep i-00000107
euca-reboot-instances i-00000107
euca-describe-instances | grep i-00000107
euca-describe-addresses | grep None
euca-allocate-address -i i-00000107 192.168.77.221
euca-associate-address -i i-00000107 192.168.77.221
euca-describe-instances | grep i-00000107
euca-describe-instances | grep 242
exit
history
內(nèi)存:
cat /proc/meminfo
dmesg|grep -i ^mem
free -m
啟動實例:euca-run-instances ami-00000017 -t m1.hcXCF?? ????
啟動nova-compute服務(wù)
sudo nova-manage service enable dev-compute1 nova-compute
?停止指定機器的nova-compute
?sudo nova-manage service disable dev-compute4 nova-compute
?euca-describe-availability-zones verbose
?sudo apt-get autoremove nova-compute
?sudo apt-get install -y? nova-compute
?virsh list
?euca-describe-availability-zones verbose
?sudo service nova-compute restart
?---------------調(diào)整kvm 擴大quota--------------
?sudo nova-manage project quota --project=kvm ?
?sudo nova-manage project quota --project=kvm? --key=instances --value=640
?sudo nova-manage project quota --project=kvm? --key=gigabytes --value=32768
?sudo nova-manage project quota --project=kvm? --key=cores? --value=2560
?sudo nova-manage project quota --project=kvm? --key=floating_ips?? --value=640
?sudo nova-manage project quota --project=kvm?? --key=metadata_items --value=1024
?sudo nova-manage project quota --project=kvm?? --key=injected_file_content_bytes --value=40960
?sudo nova-manage project quota --project=kvm?? --key=injected_files --value=30
?sudo nova-manage project quota --project=kvm?? --key=volume --value=80
?sudo nova-manage project quota --project=kvm?? --key=injected_files --value=100
轉(zhuǎn)載于:https://www.cnblogs.com/haochuang/archive/2012/03/13/2393742.html
總結(jié)
以上是生活随笔為你收集整理的[原]一些KVM测试过程中的命令笔记(2)分配实例的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Threading in C#
- 下一篇: 十六个 HTML,CSS,jQuery,