Volume 2, No. 02, April 2013 ISSN 2278-1080 The International Journal of Computer Science & Applications (TIJCSA) RESEARCH PAPER Available Online at http://www.journalofcomputerscience.com/ Implementation of Database as a Service in a Private Cloud using EUCALYPTUS Arunkumar.G Department of Information Technology SRM University Kattankulathur,Chennai,India arunkumar.goge@gmail.com Magesh.S Asst.Proffesor(Sr.G) Department of Information Technology SRM University Kattankulathur,Chennai,India magesh.s@ktr.srmuniv.ac.in Abstract In the world of computing every organisation strives hard to achieve optimal performance and efficient resource utilisation in their infrastructure. However the existing technology resolves their problem up to some extent only. Cloud computing is a technology where the Infrastructure, Software and Platform capabilities are provided as a service to the user. Currently, Amazon the most popular public cloud service provider uses pay as we go model. The user has to pay in order to use the service based on service level agreements (SLA). In public cloud the infrastructure is located remotely. The proposed model is to build a private cloud in our infrastructure using eucalyptus software platform and provide database as a service to the user. Private cloud is also called as internal cloud in which services are provided and managed internally in an organisation and cannot be accessible externally. This infrastructure provides database software as a service [9] to the user. Keywords: Infrastructure, Service level agreement, Database management system 1. Introduction Eucalyptus is an open source software platform to implement private cloud and also supports the integration of private cloud and public cloud to form a hybrid cloud [1]. It is compatible with Amazon s API and it is possible to migrate the instance to the public cloud. It has a web interface to make the cloud tasks easier. Administrative tasks are carried out by both web interface and command lines. It has five components that interact with each other to leverage cloud service to the user. They are Cloud Controller (CLC), 2013, http://www.journalofcomputerscience.com - TIJCSA All Rights Reserved 70
Walrus, Storage Controller (SC), Cluster Controller (CC) and Node Controller (NC). (Ref figure: 1). Virtualization is an enabler for cloud computing. Using virtualization the physical resource are partitioned and allocated for the execution of machine image [2]. Machine images are executed form of operating system which doesn t need installation and can be executed in virtual machine. In this proposed system we implement a type I (Baremetal Hypervisor) to run the machine image [3]. Type I hypervisor doesn t have virtualization layer in it. Hypervisor uses operating system kernels to run the machine image. Baremetal hypervisor supports both hardware assisted and para virtualization. K Virtual Machine (KVM) used in our proposed model. Walrus Figure 1: Eucalyptus Architecture Walrus is repository for storing a machine image. These images are called Eucalyptus Machine Images (EMI). EMI are compatible to run in amazon s public cloud. When the instance is initiated a local copy of EMI is sent to node controller [4] to perform user tasks and the EMI will be executed. Storage Controller Storage Controller provides persistent block storage for use by the instances. The storage controller (SC) comprises of many volumes. The volume is attached to instance to store user data. The volume and its snapshot are stored in SC. The attached volume must be mounted to store the user data [4]. Cluster Controller Cluster controller (CC) collects the information about the node controller and schedules the execution of instance to a particular node. In the cluster many nodes can be attached. Cluster controller manages the nodes in the particular cluster [4]. 2013, http://www.journalofcomputerscience.com - TIJCSA All Rights Reserved 71
Node Controller Node Controller is the component where the actual machine images are executed. The node controller uses hypervisor to execute the EMI. The statistics about the instances are updated to the cluster controller. Any type 1 hypervisor can be used to run the instance [4]. 2. Installation and Configurations Eucalyptus installation needs two machines. Cloud Controller, Walrus, Storage Controller and Cluster Controller in single machine called front end and a machine to install node controller. It is also possible to install each component in a separate machine. In our proposed system we use eucalyptus 3.2 fast start iso. Node Controller Installation Eucalyptus node controller installation follows same installation steps as Centos installation. During installation setup a static IP by using the network manager. The IP of the node controller don t change over time. (Ref Figure: 2) Figure 2: Network configuration 2013, http://www.journalofcomputerscience.com - TIJCSA All Rights Reserved 72
Front End Installation Front end installation have eucalyptus cloud network configuration window during installation. Front end must have a static IP. In eucalyptus cloud network configuration the private and public IP ranges need to be filled. Eucalyptus cloud configuration will follow next to network setting. (Ref Figure: 3) Private IP: Private IP s are used to communicate within the eucalyptus components. The number of running instances communicates to eucalyptus components using private IP s. Public IP: Public IP s are mapped to instance for the external users to access it. The maximum number of IP s, the maximum number of instance can run. The overlapping of private and public IP must be avoided. 2.1. Networking Figure 3: Cloud Configuration Eucalyptus currently supports four types of networking.they are Managed, Managed No VLan, System, Static. Based on the network modes the facilities like elastic IP s, VM Isolation, Security Group, DHCP server will be determined. Eucalyptus instances typically have two IPs associated with them a private and public IP s. Private IPs are 2013, http://www.journalofcomputerscience.com - TIJCSA All Rights Reserved 73
intended for internal communications between instances. Public IP s are used for external access and are usually routable outside of Eucalyptus cloud. This is called Elastic IP [6]. Security groups [7] are networking access rules that are defined and attached to instance. Protection of communication between instances to instance that belong to other security groups is called VM isolation [5]. Eucalyptus can assign IP to the instance uisng its own DHCP server. Elastic IP VM Isolation Security Group DHCP Server Managed Yes Yes Yes Yes Managed (NoVLan) Yes No Yes Yes System No No No No Static No No No Yes Figure 4: Cloud Admin Dashboard. 2013, http://www.journalofcomputerscience.com - TIJCSA All Rights Reserved 74
2.2. Running an instance Figure 4: Cloud User Dashboard. 1.Running an instance can be done by both CLI and also by user console. Initially we need to add the image from eustore. (Ref Figure: 5) # eustore-describe-images 2.This command will return a list of available images from the eucalyptus image store. 4150406313 centos i386 2011.07.02 CentOS 5 1.3GB root, Hypervisor-Specific Kernels 1643448352 centos x86_64 2011.07.02 CentOS 5 1.3GB root, Hypervisor-Specific Kernels 2215913473 centos x86_64 2011.12.28 CentOS 5 1.3GB root, Single Kernel 3235725435 centos x86_64 2012.1.14 CentOS 5 1.3GB root, Single Kernel 3.Now pick an available image from the returned list and note its image ID and execute the command. # eustore-install-image -b testbucket -i 3235725435 4.This will return the list of available images that are stored in walrus. 2013, http://www.journalofcomputerscience.com - TIJCSA All Rights Reserved 75
# euca-describe-images 5.Then we must add a keypair to run the instance. # euca-add-keypair euca-demo > euca-demo.private # chmod 0600 euca-demo.private # euca-run-instance k <keypair> emi-<image id> 6. Check to see if your instance is available for use. # euca-describe-instance <instance-id> 7.Login to the instance using ssh. To get the ip use euca-describe-instances command. # ssh i euca-demo.pem root@<the public ip of instance> 8.To terminate the instance. # euca-terminate-instances <instance id> 2.3. Attaching EBS volume to instance 1.Attaching an EBS volume [8] to an instance can be done by both CLI and user console. First create a vloume. # euca-create-volume --zone <clustername> --size <size in gb> 2.Execute the command to get volume id. # euca-describe-vloumes 3.Attach the volume to the running instance. To get the instance id use euca-describeinstances command. # euca-attach-volume <volume-id> -i <instance-id> -d <device-name> 4.To check if the ebs is attached to volume or not. # fdisk l 5.To detach ebs from instance. # euca-detach-volume <volume-id> 6.To delete the volume. # euca-delete-volume <volume-id> 2.4. Tranfering an instance to BfEBS BfEBS is Boot from Elastic Block Storage simillar to block device mapping concepts per Amazon EC2. The instance running from the Walrus cannot store the data and configurations. Whenever the instance is restarted the changes will be purged. Hence it is 2013, http://www.journalofcomputerscience.com - TIJCSA All Rights Reserved 76
advised to create a emi using the running instance and store it in BfEBS. To do this we must attach a volume that is big enough to store root partition. The root partition will be copied to the volume and the volume can be registerd as a emi. Your instance needs to have parted and rsync installed. Rsync is tool to copy and synchronize file trees and directories. 1.Creating the filesystem and lableing the attached volume. # mkfs.ext3 /dev/vdb1 -L rootdisk # mkfs.ext3 /dev/vdb1 -L cloudimg-rootfs 2.Mounting and copying the instance to the attached volume. # mount /dev/vdb1 /mnt # rsync -avhxp / /mnt/ 3. Removing device specific configuration files. # rm -f /mnt/etc/udev/rules.d/70-persistent-net.rules # sed -i /`hostname`/d /mnt/etc/hosts 4. Copying the GRUB files. # cp /mnt/usr/share/grub/x86_64-<os specific>/* /mnt/boot/grub # mount -o bind /proc /mnt/proc # mount -o bind /dev /mnt/dev # chroot /mnt 5. Creating a snapshot from volume and registering as bfebs. # euca-create-snapshot vol-<volume-id> # euca-register n <image name> --root-device-name /dev/vda b /dev/vda=snap- <snapshot id> 2.5. Installing MySql in the EBS MySql is world s most used open source relational database management system. To install MySql in ebs ssh into the instance, attach elastic block storage and follow the commands. 1.Updating the repositories. # yum update 2013, http://www.journalofcomputerscience.com - TIJCSA All Rights Reserved 77
# yum upgrade y 2.Now we install xfsprogs and MySql server. Xfsprogs is a utility for managing xfs high performance journaling filesystem that supports large filesystems, extended attributes, variable block sizes and makes extensive use of Btrees the aid to both performance and scalability. # yum install y xfsprogs mysql-server 3.Create an XFS file system on the EBS volume and mount it as /vol. Some commands need root priveleges. # grep -q xfs /proc/filesystems modprobe xfs # mkfs.xfs /dev/sdb # echo "/dev/sdh /vol xfs noatime 0 0" sudo tee -a /etc/fstab # mkdir -m 000 /vol # mount /vol 4. The EBS volume mounted on the instance with a good file system. Now we move mysql files to mounted vol/ and update mysql to follow the path using mount bind. First need to stop the mysql service then move the files. # service mysql stop # mkdir /vol/etc /vol/lib /vol/log # mv /etc/mysql /vol/etc/ # mv /var/lib/mysql /vol/lib/ # mv /var/log/mysql /vol/log/ # mkdir /etc/mysql # mkdir /var/lib/mysql # mkdir /var/log/mysql # echo "/vol/etc/mysql /etc/mysql none bind" tee -a /etc/fstab # mount /etc/mysql # echo "/vol/lib/mysql /var/lib/mysql none bind" tee -a /etc/fstab # mount /var/lib/mysql #echo "/vol/log/mysql /var/log/mysql none bind" tee -a /etc/fstab # mount /var/log/mysql 5.Now we start the mysql by #service mysql start 2013, http://www.journalofcomputerscience.com - TIJCSA All Rights Reserved 78
3. Conclusion Database as a Service offer organizations new and unique way to use and managing databases. Snapshots can be used to take backup. This also offers significant cost savings, improved service levels and greater leverage of information across the business. Using LAMP stack in the instance, more user can use the service concurrently or user can ssh into the instance. This can be implemented in any organisation who focus on efficient resource utilization. Apart from the above mentioned advantages, this concept can be useful in tackling problems like high data traffic and lower internet speeds by creating local host services. This can also aid in testing and implementing basic research, developments and in implementing newer algorithms in the cloud computing sectors by providing a local private cloud network. References [1] Open source prive hybrid cloud from Eucalyptus http://www.eucalyptus.com/eucalyptuscloud/iaas. [2] White paper on Virtualization Overview by VMare inc. http://www.vmware.com/pdf/virtualization.pdf. [3] IEEE paper on the topic Quantitative Comparison of Xen and KVM, by Todd Deshane, Zachary Shepherd, Jeanna N. Matthews, Muli Ben-Yehuda, Amit Shah and Balaji Rao. [4] Johnson D, Kiran Murari. Eucalyptus Beginner's Guide UEC Edition v1.0, 25 May 2010. Pages 2-4 [5] S. Soltesz, M. Fiuczynski, L. Peterson, M. McCabe, J. Matthews. Virtualization on the Performance,Isolation, and Scalability of Para- and Paene- Virtualized Systems. Submitted to Eurosys 2006. [6] Amazon EC2 Elastic IP Addresses http://aws.amazon.com/articles/1346. [7] Amazon Elastic Compute Cloud User Guide (API Version 2012) http://awsdocs.s3.amazonaws.com/ec2/latest/ec2-ug.pdf. [8] Storage Options in the AWS Cloud by Joseph G. Baron, Principal Solutions Architect. AWS Gov Cloud Summit II, 2009. [9] International Journal of Future Generation Communication and Networking. Database Management System as a Cloud Service by Yvette E. and GelogoYvette E. 2013, http://www.journalofcomputerscience.com - TIJCSA All Rights Reserved 79
2013, http://www.journalofcomputerscience.com - TIJCSA All Rights Reserved 80