浣跨敤GFS闆嗙兢閮ㄧ讲KVM铏氭嫙鍖栧钩鍙?瀹炰緥!!!)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了浣跨敤GFS闆嗙兢閮ㄧ讲KVM铏氭嫙鍖栧钩鍙?瀹炰緥!!!)相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/gate' title='gate'>gate baseurl 鏌ョ湅cpu file 璋冭瘯 smo 鍚屾 鍛戒护 妗ユ帴
瀹為獙鐜4鍙癎FS鑺傜偣鏈嶅姟鍣ㄥ仛GlusterFS闆嗙兢,鎻愪緵瀛樺偍鏈嶅姟缁橩VM瀹㈡埛绔仛铏氭嫙鍖?/strong> |
鏈嶅姟鍣ㄨ鑹?/th> | IP鍦板潃 | 纾佺洏绌洪棿 |
---|---|---|---|
gfs-node1 | 192.168.142.152 | 40G+40G | |
gfs-node2 | 192.168.142.154 | 40G+40G | |
gfs-node3 | 192.168.142.162 | 40G+40G | |
gfs-node4 | 192.168.142.163 | 40G+40G | |
kvm-client | 192.168.142.163 | 40G |
绗竴姝?閮ㄧ讲GFS鑺傜偣鏈嶅姟鍣?/h2>
1.涓哄洓鍙癎FS鑺傜偣鏈嶅姟鍣ㄦ湇鍔″櫒姣忓彴娣诲姞涓€涓柊纾佺洏
#!/bin/bash systemctl stop firewalld.service setenforce 0 #鏍煎紡鍖栫鐩?echo "the disks exist list:" fdisk -l |grep 鈥樼鐩?/dev/sd[a-z]鈥?echo "==================================================" PS3="chose which disk you want to create:" select VAR in `ls /dev/sd*|grep -o 鈥榮d[b-z]鈥榺uniq` quit do case $VAR in sda) fdisk -l /dev/sda break ;; sd[b-z]) #create partitions echo "n p w" | fdisk /dev/$VAR #make filesystem mkfs.xfs -i size=512 /dev/${VAR}"1" &> /dev/null #mount the system mkdir -p /data/${VAR}"1" &> /dev/null echo -e "/dev/${VAR}"1" /data/${VAR}"1" xfs defaults 0 0 " >> /etc/fstab mount -a &> /dev/null break ;; quit) break;; *) echo "wrong disk,please check again";; esac done #鎺堜簣鎵ц鏉冮檺 chmod +x a.sh #鎵ц鑴氭湰 ./a.sh #娉ㄦ剰淇敼涓绘満鍦板潃!!! cat >>/etc/hosts<<-EOF 192.168.142.152 node1 192.168.142.154 node2 192.168.142.162 node3 192.168.142.163 node4 192.168.142.163 kvm EOF #鍒涘缓yum婧愪粨搴?#杩涘叆yum浠撳簱鐩綍 cd /etc/yum.repos.d #鍒涘缓澶囦唤鏂囦欢澶?mkdir bak #绉诲姩浣跨敤鏂囦欢鍒板浠芥枃浠跺す mv C* bak #娓呴櫎yum缂撳瓨 yum clean all #鍒涘缓绉佹湁yum婧?cat >GLFS.repo<<-EOF [demo] name=demo baseurl=http://123.56.134.27/demo gpgcheck=0 enable=1 [gfsrepo] name=gfsrepo baseurl=http://123.56.134.27/gfsrepo gpgcheck=0 enable=1 EOF #閲嶆柊鍔犺浇yum婧?yum list #瀹夎蹇呰杞欢鍖?yum install -y glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma #鍚姩glusterd鏈嶅姟 systemctl start glusterd.service #璁惧畾寮€鏈鸿嚜鍚姩glusterd鏈嶅姟 systemctl enable glusterd.service #璁惧畾鏃堕棿鍚屾闃块噷鏃堕棿鏈嶅姟鍣?ntpdate ntp1.aliyun.com
3.鍥涘彴鑺傜偣閮ㄧ讲瀹屾瘯,鍦╪ode1鑺傜偣涓婃搷浣?/strong>
#娣诲姞鍏朵粬鑺傜偣淇℃伅
gluster peer probe node2
gluster peer probe node3
gluster peer probe node4
#鍒涘缓鍒嗗竷寮忓嵎
gluster volume create dis-volume replica 2 node1:/data/sdb1 node2:/data/sdb1 node3:/data/sdb1 node4:/data/sdb1 force
#鍚姩鍒嗗竷寮忓嵎
gluster volume start dis-volume
绗簩姝? 瀹㈡埛绔儴缃睰VM鎿嶄綔
1.璋冭瘯瀹㈡埛绔幆澧?鍐呭瓨鏈€灏?G,寮€鍚櫄鎷熷寲寮曟搸
#鍒涘缓鎸傝浇鐩綍
mkdir /data
#鎸傝浇鍒嗗竷寮忓嵎鍒板鎴风鐩綍
mount.glusterfs node1:dis-vol /data
#鏌ョ湅纾佺洏鍒嗗尯淇℃伅
df -hT
#杩滅▼鎸傝浇寰蒋瀹夸富鏈轰笂鐨勯暅鍍?鍚庨潰鍐嶇敤
mount.cifs //192.168.142.1/ISO /mnt
3.瀹夎KVM
#瀹夎妗岄潰鐜缁勪欢鍖?yum groupinstall "GNOME Desktop" -y
#瀹夎KVM妯″潡
yum install qemu-kvm -y
#瀹夎KVM璋冭瘯宸ュ叿
yum install qemu-kvm-tools -y
#瀹夎鏋勫缓铏氭嫙鏈虹殑鍛戒护琛屽伐鍏?yum install virt-install -y
#瀹夎qemu缁勪欢锛屽垱寤虹鐩橈紝鍚姩铏氭嫙鏈?yum install qemu-img -y
#瀹夎缃戠粶鏀寔宸ュ叿
yum install bridge-utils -y
#瀹夎铏氭嫙鏈虹鐞嗗伐鍏?yum install libvirt -y
#瀹夎鍥惧儚鍖栫鐞嗚櫄鎷熸満
yum install virt-manager -y
#鏌ョ湅CPU鏄惁鏀寔铏氭嫙鍖?铏氭嫙鏈洪渶瑕侀厤缃腑寮€鍚櫄鎷熷寲鍔熻兘)
egrep 鈥?vmx|svm)鈥?/proc/cpuinfo
#鏌ョ湅kvm妯″潡鏄惁瀹夎
lsmod | grep kvm
#寮€鍚痩ibvirtd鏈嶅姟
systemctl start libvirtd
#鏌ョ湅libvirtd鏈嶅姟鐘舵€?systemctl status libvirtd
#寮€鏈鸿嚜鍚姩libvirtd鏈嶅姟
systemctl enable libvirtd
4.閮ㄧ讲linux铏氭嫙鏈虹幆澧?/strong>
#鍒囨崲鑷虫寕杞界偣
cd /data
#鍒涘缓澶囦唤鐩綍
mkdir vdisk viso
#鍚庡彴澶嶅埗闀滃儚
cp -r /mnt/CentOS-7-x86_64-DVD-1708.iso /data/viso/ &
#鍒囨崲缃戝崱閰嶇疆鐩綍
cd /etc/sysconfig/network-scripts/
#澶嶅埗ens33 缃戝崱閰嶇疆鏂囦欢浣滀负妗ユ帴缃戝崱鐨勬ā鏉?cp -p ifcfg-ens33 ifcfg-br0
#缂栬緫ens33 缃戝崱閰嶇疆鏂囦欢
vim ifcfg-ens33
#灏捐杩藉姞妗ユ帴
BRIDGE=br0
#缂栬緫妗ユ帴 缃戝崱閰嶇疆鏂囦欢
vim ifcfg-br0
#鏇挎崲绫诲瀷涓篵ridge妗ユ帴妯″紡
TYPE=bridge
#淇敼涓洪潤鎬佹ā寮?BOOTPROTO=static
#鏀瑰悕
NAME=br0
#鏀归┍鍔ㄥ悕绉?DEVICE=br0
#杩藉姞IP鍦板潃,鎺╃爜鍜岀綉鍏?IPADDR=192.168.142.164
NETMASK=255.255.255.0
GATEWAY=192.168.142.1
#閲嶅惎缃戠粶鏈嶅姟
service network restart
绗笁姝?KVM鍥惧舰鍖栫鐞?/h2>
1.鎵撳紑缁堢浠oot韬唤杈撳叆涓€涓嬪懡浠ゅ垏鎹㈠浘褰㈠寲绠$悊鐣岄潰
#鎵撳紑缁堢杈撳叆涓€涓嬪懡浠ゅ垏鎹㈠浘褰㈠寲绠$悊鐣岄潰
virt-manager
2.鍒涘缓閮ㄧ讲铏氭嫙鍖栫幆澧?/strong>
鍒涘缓瀛樺偍姹狅紝鍙屽嚮QEMU/KVM锛岄€夋嫨鈥滃瓨鍌ㄢ€濋€夐」鍗★紝鐒跺悗鍗曞嚮鈥?鈥濇寜閽柊寤哄瓨鍌ㄦ睜銆?鍗曞嚮鈥滃墠杩涒€濇寜閽紝鏍规嵁鎻愮ず杈撳叆鎴栨祻瑙堢敤浠ヨ缃瓨鍌ㄧ洰褰曪紝濡?data_kvm/store,鏈€鍚庡崟鍑烩€滃畬鎴愨€濇寜閽嵆鍙?/code>
Docker涔媠warm閮ㄧ讲闆嗙兢
Flask 鍜?Google App Engine 閮ㄧ讲妯″瀷鏈嶅姟