Geo-replication-1

From PRAGMA wiki
Jump to: navigation, search

An example

In this example,

  • the VM image was made on a VM hosting server at AIST, running Rocks 5.3 with XEN roll
  • The image file was gzip'ed for download
  • The VM image is replicated on SDSC VM hosting server
  • The original VM image has two network interfaces (one private and one public), the clond VM has only one public network interface

Create a new VM with SFI VC disk image on SDSC VM hosting server

  • Create a new VM
[root@fiji ~]# rocks add host vm fiji.rocksclusters.org membership="Hosted VM" name=geogrid
added VM geogrid on physical node fiji
  • Get the MAC addresses and find the image file path for the new VM.
[root@fiji ~]# rocks set host interface subnet geogrid eth0 public
[root@fiji ~]# rocks list host interface geogrid
SUBNET IFACE MAC               IP NETMASK MODULE NAME    VLAN OPTIONS CHANNEL
public eth0  b6:58:ca:00:00:5f -- ------- ------ geogrid ---- ------- -------
[root@fiji ~]# rocks list host vm geogrid showdisks=y
SLICE MEM   CPUS MAC               HOST DISK                                               DISKSIZE
13    1024  1    b6:58:ca:00:00:5f fiji file:/state/partition1/xen/disks/geogrid.hda,hda,w 36
  • Copy disk image file to new VM file location.
[root@fiji ~]# cd /state/partition1/xen/disks/
[root@fiji disks]# wget http://www.apgrid.org/frontend-0-0-9.pywps.hda.gz
[root@fiji disks]# mv frontend-0-0-9.pywps.hda.gz geogrid.hda.gz
[root@fiji disks]# gunzip geogrid.hda.gz

Modify the new disk image before boot

  • Mount the image file on the VM hosting server.
[root@fiji disks]# lomount -diskimage geogrid.hda -partition 1 /media
  • Modify network interface config.
[root@fiji disks]# vi /media/etc/sysconfig/network-scriptsifcfg-eth0
[root@fiji disks]# cat /media/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=b6:58:ca:00:00:5f
IPADDR=198.202.88.203
NETMASK=255.255.255.0
BOOTPROTO=static
ONBOOT=yes
MTU=1500
[root@fiji disks]# vi /media/etc/sysconfig/network
[root@fiji disks]# cat /media/etc/sysconfig/network | grep GATEWAY
GATEWAY=198.202.88.20
[root@fiji disks]# vi /media/etc/resolv.conf
[root@fiji disks]# cat /media/etc/resolv.conf | grep nameserver
nameserver 127.0.0.1
nameserver 198.202.75.26
  • Add ssh public key to root authrized_keys.
[root@fiji disks]# vi /media/root/.ssh/authorized_keys
(add ssh public key)
  • Unmount.
[root@fiji disks]# umount /media
  • Start the new VM
[root@fiji disks]# rocks set host boot action=os geogrid
[root@fiji disks]# rocks list host boot geogrid
ACTION
os
[root@fiji disks]# rocks start host vm geogrid
[root@fiji disks]# rocks list host vm geogrid status=y
SLICE MEM   CPUS MAC               HOST STATUS
13    1024  1    b6:58:ca:00:00:5f fiji active

Change hostname and other configurations

  • Login to the new VM
[root@fiji ~]# ssh 198.202.88.203
Last login: Wed Feb 16 14:24:14 2011 from 198.202.88.180
Rocks 5.3 (Rolled Tacos)
Profile built 09:25 03-Feb-2011

Kickstarted 18:55 03-Feb-2011
  • Change hostname
[root@wpsvm ~]# hostname rocks-203
[root@wpsvm ~]# vi /etc/sysconfig/network
[root@wpsvm ~]# grep HOSTNAME /etc/sysconfig/network
HOSTNAME=rocks-203.sdsc.edu
[root@wpsvm ~]# vi /etc/hosts
[root@wpsvm ~]# cat /etc/hosts
127.0.0.1       localhost.localdomain   localhost
#10.1.1.1       wpsvm.local wpsvm # originally frontend-0-0
198.202.88.203  rocks-203.sdsc.edu
[root@wpsvm ~]# vi /etc/auto.home
[root@wpsvm ~]# cat /etc/auto.home
John     rocks-203.local:/export/home/john
tom      rocks-203.local:/export/home/tom
jane     rocks-203.local:/export/home/jane
  • Modify PyWPS config files
[root@wpsvm ~]# vi /usr/local/pywps-3.1.0/pywps/etc/pywps.cfg
[root@wpsvm ~]# grep rocks-203 /usr/local/pywps-3.1.0/pywps/etc/pywps.cfg
serveraddress=http://rocks-203.sdsc.edu/pywps/wps
outputUrl=http://rocks-203.sdsc.edu/wps/wpsoutputs
[root@wpsvm ~]# vi /srv/pywps/sfi/pywps.cfg 
[root@wpsvm ~]# grep rocks-203 /srv/pywps/sfi/pywps.cfg
serveraddress=http://rocks-203.sdsc.edu/pywps/sfi/wps
outputUrl=http://rocks-203.sdsc.edu/wps/wpsoutputs
  • Modify HTTP config file
[root@wpsvm ~]# vi /etc/httpd/conf/httpd.conf 
[root@wpsvm ~]# grep sdsc /etc/httpd/conf/httpd.conf
ServerAdmin supporter@sdsc.edu
ServerName rocks-203.sdsc.edu:80
[root@wpsvm ~]# /sbin/chkconfig httpd on
[root@wpsvm ~]# /etc/init.d/httpd start
  • Modify iptables
[root@wpsvm ~]# vi /etc/sysconfig/iptables
[root@wpsvm ~]# grep www /etc/sysconfig/iptables
-A INPUT -m state --state NEW -p tcp --dport www -j ACCEPT
[root@wpsvm ~]# /etc/init.d/iptables restart
  • Reboot
# reboot

Test

  • Test PyWPS and Apache

Point your browser to http://rocks-203.sdsc.edu/pywps/wpstest?service=WPS&request=GetCapabilities, http://rocks-203.sdsc.edu/pywps/wpstest?service=WPS&request=DescribeProcess&version=1.0.0&Identifier=exampleBufferProcess. You should see XML pages.