浣跨敤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鑺傜偣鏈嶅姟鍣ㄦ湇鍔″櫒姣忓彴娣诲姞涓€涓柊纾佺洏

鎶€鏈浘鐗? src=#!/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,寮€鍚櫄鎷熷寲寮曟搸
鎶€鏈浘鐗? src=#鍒涘缓鎸傝浇鐩綍 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>

鎶€鏈浘鐗? src=Docker涔媠warm閮ㄧ讲闆嗙兢

Redis闆嗙兢閮芥湁鍝簺妯″紡

ansible鑷姩鍖栧畨瑁呭強閮ㄧ讲httpd

Flask 鍜?Google App Engine 閮ㄧ讲妯″瀷鏈嶅姟

Ubuntu铏氭嫙鏈轰腑鏃堕棿涓巜indows鏃堕棿涓嶄竴鑷寸殑闂瑙e喅

娴呰皥 Mac 榛戣嫻鏋?Hackintosh 瀹夎浣跨敤

(c)2006-2024 SYSTEM All Rights Reserved IT常识