Archives for the month of: September, 2008

Recently I have switch my clients over to either BeanStalk or GitHub, and I have to admit it is actually really nice to not have to worry about source control systems any more. It is one of those places where you really don’t add a ton of value by controlling the platform, and both systems have some really nice integrations, and since my BeanStalk client is big into Campfire and ZenDesk it does really tie together their world.

Git is still new to me and I’m only using it on the one project right now – though I have already seen the value in being able to quickly branch and also being able to commit locally (when on flights etc) really helps you make sure the commit messages are meaningful. I’m hoping to see a lot more of git in the next couple of months since I’m going to try and move all the new projects that way. Though if you are still happy on Subversion then BeanStalk is definitely worth a look.

Over the past couple of months I’ve been working on a few different things,  and I’ve been a little overloaded – thus the lack of blogging.  One of those things has been working on building a dynamic integration test environment for a company based on using EC2.   Part of that environment has required the provisioning of Oracle servers for the test platform.  Initially I took a Centos 5 base and installed the Oracle 11g instance on it,  though I have to admit getting the first image ready for use took a long time and was a lot more painful than I had hoped (not least because of the silent installers in Oracle).  

So when I saw on Justin Kestelyn twitter than Oracle now has a Cloud Computing Center I had to give it a go.  After only playing for a very short while I have to say I really liked the experience from the AMI’s,   I thought the easiest way to tell you about it was just to give some basic instructions on getting going.  First I’m going to assume you have an AWS account and that you have also set-up the EC2 command line tools to get you going (if you are having trouble with the command line tools I find the tools at RightScale just rock for managing the servers).

So to get started I kicked up a terminal on my trusty mac and listed down the available images.

pdodds:/usr/local/ec2/bin$ ./ec2-describe-images -a | grep oracle-corporation
IMAGE	ami-02cb2f6b	/oracle-corporation/database-ami/64-bit/oracle_11106_SE_SE1_64Bit-image.manifest.xml	725966715235	available	public		x86_64	machine	aki-0d9f7b64	ari-369f7b5f
IMAGE	ami-7acb2f13	oracle-corporation/database-ami/32-bit/oracle_10g_XE_32Bit-image.manifest.xml	725966715235	available	public		i386	machine	aki-c5e703ac	ari-c2e703ab
IMAGE	ami-cecb2fa7	oracle-corporation/database-ami/32-bit/oracle_11106_EE_32Bit-image.manifest.xml	725966715235	available	public		i386	machine	aki-c5e703ac	ari-c2e703ab
IMAGE	ami-7ecb2f17	oracle-corporation/database-ami/64-bit/oracle_11106_EE_64Bit-image.manifest.xml	725966715235	available	public		x86_64	machine	aki-0d9f7b64	ari-369f7b5f
IMAGE	aki-c5e703ac	oracle-corporation/oracle_linux_kernels/32_bit/2.6.18-53.1.13.9.2.el5xen/vmlinuz-2.6.18-53.1.13.9.2.el5xen.manifest.xml	725966715235	available	public		i386	kernel
IMAGE	ari-c2e703ab	oracle-corporation/oracle_linux_ramdisks/32_bit/2.6.18-53.1.13.9.2.el5xen/initrd-2.6.18-53.1.13.9.2.el5xen.img.manifest.xml	725966715235	available	public	i386	ramdisk

Since I just wanted a little instance to play with I picked up the /oracle_11106_EE_32Bit, and started that, note that I had already created a default security group (with port 22 access) and a default keypair which I had on my machine.

pdodds:/usr/local/ec2/bin$ ./ec2-run-instances -k primary-keypair -g default ami-cecb2fa7
RESERVATION	r-2ed30047	207015290718	default
INSTANCE	i-0b842462	ami-cecb2fa7			pending	primary-keypair	0	m1.small	2008-09-22T21:14:17+0000	us-east-1a	aki-c5e703ac	ari-c2e703ab
pdodds:/usr/local/ec2/bin$

Next up I wanted to stick the database on an EBS volume to I decided to create one of those while I’m here (and waiting for that server to start). Note that since I was a bit lazy on setting the availability zone I wanted for the server I’ll be a little more disciplined on the volume (note that volumes need to be in the same availability zone as the server).

pdodds:/usr/local/ec2/bin$ ./ec2-create-volume -s 5 -z us-east-1a
VOLUME	vol-1104e178	5		us-east-1a	creating	2008-09-22T21:17:14+0000
pdodds:/usr/local/ec2/bin$

Now if all is well I should be able to check back on my EC2 instance to see if it is available.

pdodds:/usr/local/ec2/bin$ ./ec2-describe-instances i-0b842462
RESERVATION	r-2ed30047	207015290718	default
INSTANCE	i-0b842462	ami-cecb2fa7	ec2-75-101-230-110.compute-1.amazonaws.com	domU-12-31-39-00-E0-07.compute-1.internal	running	primary-keypair	0		m1.small	2008-09-22T21:14:17+0000	us-east-1a	aki-c5e703ac	ari-c2e703ab
pdodds:/usr/local/ec2/bin$

Once it is available, as above then we can attach the EBS volume that we created.

pdodds:/usr/local/ec2/bin$ ./ec2-attach-volume vol-1104e178 -i i-0b842462 -d /dev/sdh
ATTACHMENT	vol-1104e178	i-0b842462	/dev/sdh	attaching	2008-09-22T21:24:02+0000
pdodds:/usr/local/ec2/bin$

While that is getting hooked up, we can now log into the new server – with simple ssh -i primary-keypair root@ec2-75-101-230-110.compute-1.amazonaws.com.

At this point we accept the license terms and then set the new password, though I would recommend switching off password based connections to the server (for anyone). When we get to the “Would you like to create a database now [y|n]:” lets say no first time. Since we still need to get that EBS drive ready for use. This will drop you back to the root login, though it is easy to get back to the script.

$ mkfs /dev/sdh
mke2fs 1.39 (29-May-2006)
/dev/sdh is entire device, not just one partition!
Proceed anyway? (y,n) y

I’m probably far to lazy, but this will just get me a drive ready for use, and then its back to the Oracle script, this time we select our new device for our database to be stored, and also the flash recovery area.

/home/oracle/scripts/run_dbca.sh
The Oracle Database Software (ORACLE_HOME) has been installed at
/u01/app/oracle/product/11.1.0/db_1.
Before you can use the Oracle Software, you will need to create a database.

Would you like to create a database now [y|n]:  y

You chose to create a database now.  Before we begin, please provide the following details: 

Select a disk device to store your datafiles and redo logs on:

ID  DEVICE_NAME
--- -----------
[1] /dev/sda2
[2] /dev/sdh 

Type in the ID from the list above [DEFAULT: 1]:
2
Enter the mount point you would like this device mounted as [DEFAULT:  /u02]:

You have selected to mount /dev/sdh on to /u02, is this correct [y|n] [DEFAULT:  n]:
y

Select a disk device to store your flash recovery area files on:

ID  DEVICE_NAME
--- -----------
[1] /dev/sda2
[2] /dev/sdh 

Type in the ID from the list above [DEFAULT: 1]:
2
Using mount point /u02

You have selected to mount /dev/sdh on to /u02, is this correct [y|n] [DEFAULT:  n]:
y

Checking disk devices and mount points for Datafiles and Logfiles
Checking if directory /u02 exists...

Creating directory /u02
Trying to mount /dev/sdh on /u02
DBFILES:  /u02/oradata
FRA:  /u02/flash_recovery_area

Please enter the name for your Oracle Database.
This name will be used as your
ORACLE SID (System Identifier):

From here on in its a simple case of providing a name for the database and all the passwords for the Oracle users, and away it goes. After just a few minutes you will have your database ready to roll, the files stored on EBS and running against the Oracle AMI. It will have started the Enterprise Manager web server etc (though to be honest I kinda wish that was optional since I don’t tend to use it a whole lot).

All in all I have to say the experience was smooth and quick, making Oracle suddenly a lot more welcoming in a cloud environment and I’m sure with Oracle World in full swing we’ll be hearing a lot more about it.

And as always once you are done its nice and easy to clean up…

pdodds:/usr/local/ec2/bin$ ./ec2-terminate-instances i-0b842462
INSTANCE	i-0b842462	running	shutting-down
pdodds:/usr/local/ec2/bin$ ./ec2-detach-volume vol-1104e178
ATTACHMENT	vol-1104e178	i-0b842462	/dev/sdh	detaching	2008-09-22T21:24:02+0000
pdodds:/usr/local/ec2/bin$ ./ec2-delete-volume vol-1104e178
VOLUME	vol-1104e178
pdodds:/usr/local/ec2/bin$