2011年5月10日 星期二

XEN on CentOS Install

以下手動....
yum install -y xen virt-manager kernel-xen ipvsadm
chkconfig xend on
vim /boot/grub/grub.conf
default=0
reboot
....................

echo "Copying VMs"
for i in `seq 33 1 43`
do
echo "172.108.$i.2 NAT setting..."
ssh -l root 172.108.$i.2 "scp root@172.108.31.2:/var/lib/xen/images/*.img /var/lib/xen/images &"
ssh -l root 172.108.$i.2 "scp root@172.108.31.2:/etc/xen/ATC* /etc/xen &"
done

scp root@172.108.31.2:/var/lib/xen/images/*.img /var/lib/xen/images
scp root@172.108.31.2:/etc/xen/ATC* /etc/xen

XEN NAT

echo "Start Setting up NAT"
for i in `seq 31 1 43`
do
echo "172.108.$i.2 NAT setting..."
ssh -l root 172.108.$i.2 "ipvsadm -A -t 172.108.$i.2:10000 -s rr | ipvsadm -a -t 172.108.$i.2:10000 -r 192.168.122.5:80 -m"
ssh -l root 172.108.$i.2 "ipvsadm -A -t 172.108.$i.2:10001 -s rr | ipvsadm -a -t 172.108.$i.2:10001 -r 192.168.122.6:80 -m"
ssh -l root 172.108.$i.2 "ipvsadm -A -t 172.108.$i.2:10002 -s rr | ipvsadm -a -t 172.108.$i.2:10002 -r 192.168.122.7:80 -m"
ssh -l root 172.108.$i.2 "ipvsadm -A -t 172.108.$i.2:10003 -s rr | ipvsadm -a -t 172.108.$i.2:10003 -r 192.168.122.8:80 -m"
ssh -l root 172.108.$i.2 "ipvsadm -A -t 172.108.$i.2:10004 -s rr | ipvsadm -a -t 172.108.$i.2:10004 -r 192.168.122.9:80 -m"
ssh -l root 172.108.$i.2 "ipvsadm -A -t 172.108.$i.2:10005 -s rr | ipvsadm -a -t 172.108.$i.2:10005 -r 192.168.122.10:80 -m"
ssh -l root 172.108.$i.2 "ipvsadm -A -t 172.108.$i.2:10006 -s rr | ipvsadm -a -t 172.108.$i.2:10006 -r 192.168.122.11:80 -m"
ssh -l root 172.108.$i.2 "ipvsadm -A -t 172.108.$i.2:10007 -s rr | ipvsadm -a -t 172.108.$i.2:10007 -r 192.168.122.12:80 -m"
done


xm COMMAND

echo "Start All Xen VMs"
for i in `seq 31 1 43`
do
echo "172.108.$i.2 starting..."
ssh -l root 172.108.$i.2 "xm create ATC0 | xm create ATC1 | xm create ATC2 | xm create ATC3 | xm create ATC4 | xm create ATC5 | xm create ATC6 | xm create ATC7 &"
done


echo "Stop All Xen VMs"
for i in `seq 31 1 43`
do
echo "172.108.$i.2 stoping..."
ssh -l root 172.108.$i.2 "xm shutdown ATC0 | xm shutdown ATC1 | xm shutdown ATC2 | xm shutdown ATC3 | xm shutdown ATC4 | xm shutdown ATC5 | xm shutdown ATC6 | xm shutdown ATC7 &"
done

Test CGIs
http://172.108.31.2:10001/cgi-bin/testcgi.cgi?action=node_status
http://172.108.31.2:10002/cgi-bin/testcgi.cgi?action=node_status
http://172.108.31.2:10003/cgi-bin/testcgi.cgi?action=node_status
http://172.108.31.2:10004/cgi-bin/testcgi.cgi?action=node_status
http://172.108.31.2:10005/cgi-bin/testcgi.cgi?action=node_status
http://172.108.31.2:10006/cgi-bin/testcgi.cgi?action=node_status
http://172.108.31.2:10007/cgi-bin/testcgi.cgi?action=node_status

沒有留言:

張貼留言