Monday, August 16, 2010

Blogger why doth you hate me?

So you write a blog, you decide you want a customer domain. Blogger then makes you life hell.

I have to give credit, where its due, but if you see

Another blog is already hosted at this address.

Then go and check out Shafar's blog post.

I have been recently phrasing question design (esp. web design) along the lines "What is Facebook designed X"... at least I could have had an amusing chat with people on the merits of Blogger versus Wordpress...

Friday, August 13, 2010

More lvm2 weirdness

I have just install lv,2 on my Ubuntu 9.10 instance on EC2. I go to create the logical volume and got the following

# lvcreate -L 1g -n data_vol data_vg
/proc/misc: No entry for device-mapper found
Is device-mapper driver missing from kernel?
Failure to communicate with kernel device-mapper driver.
/proc/misc: No entry for device-mapper found
Is device-mapper driver missing from kernel?
Failure to communicate with kernel device-mapper driver.
Incompatible libdevmapper 1.02.27 (2008-06-25)(compat) and kernel driver
striped: Required device-mapper target(s) not detected in your kernel
Run `lvcreate --help' for more information.

It turns out that after install some of the modules are not loaded, so you have to

# modprobe dm_mod
# modprobe dm_mirror
# modprobe dm_snapshot

After that the command executes correctly!

# lvcreate -L 1g -n data_vol data_vg
Logical volume "data_vol" created

Can't install lvm2 on Ubuntu 9.10 on EC2?

Welcome to planet weird, or should I say Linux-planet-weird.

I wanted to create a new logical volume based on an Amazon pair of EBS volumes.

So I get to the point of creating the Physical Volume

# pvcreate /dev/sdf1
The program 'pvcreate' is currently not installed. You can install it by typing:
apt-get install lvm2
pvcreate: command not found

That was unfortunate, so I then tried ti install LVM2

# apt-get install lvm2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package lvm2 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package lvm2 has no installation candidate

After much, much banging of head against hard objects I found a solution

# apt-get update
[...]
# apt-get install lvm2
[...]

Now I have pvcreate on all the wonders from the lvm2 package!






Tuesday, May 4, 2010

MySQL ODBC drivers, Excel and Mac OS-X 10.6

What a nightmare!

So what started off as a simple problem (adding a query into a Microsoft Excel spreadsheet) turned out to be a nightmare!

This problem seemed to affect both Office 2004 and 2008, I had previously that them working in OS-X 10.5, however I just got a new machine, which is 64bit capable and running 10.6.

Looking on the MySQL download page, there were no build for 10.6, only 10.5. So I experimented.

Here's what I tried
  • MySQL ODBC Driver 5.1.6 x86 64 bit for 10.5
  • MySQL ODBC Driver 5.1.6 x86 32 bit for 10.5
From the Apple ODBC Manager, I could create a DSN, I could connect to my MySQL database just fine. Going into Excel and then Data > Get External Data > New Database Query brought up the iODBC ODBC Manager. However when I tried to connect to my database, I got the following message.

[iODBC][Driver Manager] Specified driver could not be loaded

Office 2008 (if I recall is a x86 built product), so I tried with Office 2004 which I knew was PowerPC. Still the same message.

Now what I did next is very weird but works, I installed the following
  • MySQL ODBC Driver 5.1.6 PowerPC 32 bit for 10.5
I had some issue trying to setup in the Apple ODBC Manager, so I hacked the .ini file in /Library/ODBC/odbc.ini. Here's a sample

[test]
Driver = /Develop/Developer/mysql-connector-odbc-5.1#377675/lib/libmyodbc5-5.1.6.so
PORT = 3306
DATABASE = testdb
PWD = notmyrealpassword
SERVER = db2.acme.com
UID = admin

So strike me down if this worked for Office 2004. For Office 2008 its even more weird, the PowerPC driver allows me to connect with Microsoft Query, but I need the x86 Driver to query from the spreadsheet. BUt you can't edit the query afterwards :-(

I just downgraded to Office 2004 for this, and will save the final conclusion for another day.

Tuesday, January 26, 2010

Expanding the root partition on Windows & Ubuntu

So I run out of space on my Windows XP and Ubuntu root partitions. Turns out that the same procedure works for both... its a two-for-one deal!

Step 1 - Cleanly shutdown the Virtual Machine

Step 2 - Resize the Virtual Disk
In Fusion for the Mac, this is just a question of going to the setting panel and adjusting the slide for the Disk capacity (Virtual Machines > Settings > Hard Disk).

If you are using one of the myriad of other VMWare products, one reliable way is to usevmware-vdiskmanager. This provides a mechanism to resize the virtual disk through the command line.

Step 3 - Re-partition the disk
You will need to download our use your favorite partitioning tool. I have used gparted successfully.

Using the gparted ISO disk image, its a simple task of mounting the image in the CD/DVD drive and then rebooting. Move the partitions around in order to utilize the free space in the virtual disk

Step 4 - Reboot
After you have created the free space for the O/S, reboot and you are away!

Tuesday, January 19, 2010

Fusion 3.0 slow down...fixed!

I had purchased Fusion 3, at a discount because I was part of the Beta program, but mostly because I brought into the fact that it was optimized for Snow Leopard and was faster. Was is there not to like about that.

Well, firstly, Fusion 3.0 just seemed to be much slower at taking snapshots and restoring VMs. Given that is what I'm doing 90% of the time that was a problem.

There seem to be two fixes that at least help, if not resolve the problem

1. Remove the VM directory from Spotlight indexing

Easy enough to do on System Preferences > Spotlight > Privacy

Click on the "+" and add your Virtual machine directory into the Privacy list.

2. Stop VMware for starting an index
Seems that VMWare causes a re-index scan to occur, so lets turn that off!

defaults write com.vmware.fusion PLLibrarySpotlightSearchDone -bool YES

Tuesday, January 5, 2010

Resizing a RHEL 4 & 5 LVM in a VMWare Guest

Nothing like starting the new year with an "out of space" problem.

So, I have a RHEL 5.3 image running under VMWare Fusion. I needed more space in order to install some more software... easy I thought until I tired it and with the help of several blogs and other posting, I thought I would put my recipe into words. So the challenge is to add and extra 2GB into the root filesystem

Step 1 - Cleanly shutdown your VMWare guest
Suggest that you shutdown cleanly as you can to ensure that all other steps go smoothly.

Step 2 - Remove your Snapshots of the Guest
VMWare Fusion on a Mac forces you to remove any snapshots before you can re-size the disk

Step 3 - Resize the disk
There are some command line tools for doing this, but in the 'Hardware Settings' for the guest you can resize a disk (in VMWare Fusion and above).

Step 4 - Restart your Guest
Restart you guest

Step 5 - Look at your disk space
If you look at the disk psace from your guest, you will see that it show no extra disk space! This is simply because the O/S has not seen the added space yet. Use "df" to take a look at the mounted volumes on your system.
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
3.8G 3.2G
427M 89% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 506M 0 506M 0% /dev/shm
.host:/ 233G 173G 61G 74% /mnt/hgfs

As you can see, we have 427M if space left on the root file-system "/".

Step 6 - Make sure that there is free space
You can next check if the O/S can see the free space. Use the utility "parted" to view the partitions.
[root@localhost ~]# parted
GNU Parted 1.8.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
print free

Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 107MB 107MB primary ext3 boot
2 107MB 6440MB 6333MB primary lvm
6440MB 8587MB 2147MB Free Space

(parted) quit
Step 7 - Make a new partition out of the free space
In the step above you can see the free space, which starts at 6440MB and ends at 8587MB. You now need to make a new partition, using "parted" again
[root@localhost ~]# parted
GNU Parted 1.8.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
mkpart
Partition type? primary/extended?
primary
File system type? [ext2]?
ext3
Start?
6440
End?
8587

(parted)
print

Model: VMware, VMware Virtual S (scsi)
Disk
/dev/sda: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 107MB 107MB primary ext3 boot
2 107MB 6440MB 6333MB primary lvm
3 6440MB 8587MB 2147MB primary

(parted)
quit
We have a new partition out of the free space... but we have not finished yet!

Step 8 - Create the Physical Volume from the Partition
Now that we have a partition on the disk we now create a physical volume using the "pvcreate" command.
[root@localhost ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
The device name (/dev/sda3) came from Step 7, concatenating the device name (/dev/sda) with the partitions number (3) to get /dev/sda3.

Step 9 - Determine the Volume Group
Now that we have a partition, we need to add it into the Volume Group. First find the name of the volume group using the "vgscan" command.
[root@localhost ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "
VolGroup00" using metadata type lvm2
Step 10 - Add the partition into the Volume Group
Now add the partition into the volume group using the "vgextend" command.
[root@localhost ~]# vgextend VolGroup00 /dev/sda3
Volume group "VolGroup00" successfully extended
Here's where we got the information from
  • VolGroup00 came from Step 8
  • /dev/sda3 came from Step 7, concatenating the device name (/dev/sda) with the partitions number (3) to get /dev/sda3
Step 11 - Extend the Logical Volume
Next we have to tell the Logival Volumn Manager (LVM) that we have an additional partition to add. We do this using the "lvextend" command.

[root@localhost ~]# lvextend -l +63 /dev/VolGroup00/LogVol00 /dev/sda3
Extending logical volume LogVol00 to 5.84 GB
Logical volume LogVol00 successfully resized
What the command says above is the following
  • Use partition /dev/sda3
  • On Volume /dev/VolGroup00/LogVol00 (the name comes from Step 5)
  • By 63 extents, this is roughly 2GB. There are other options that let you specific this in terms of GB, percentage free etc.
Step 12 - Now extend the filesystem
The the Logical Volume is just a collection of space. Typically you then take this space and create a file-system. Given that we have a file-system we want to extend it with the space we just added to the Logical Volume. We do this with the "resize2fs" command.

Step 12.1 - Redhat 4.x

localhost ~]# ext2online /dev/VolGroup00/LogVol00

Step 12.2 - Redhat 5.x
[root@localhost ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 1531904 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 1531904 blocks long.
This command takes all the space we added to the Logical Volume... now the acid test, do we see the free space in the file-system?

Step 13 - Check for free space
Check for the free space, using the "df" command.
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.7G 3.2G 2.3G 59% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 506M 0 506M 0% /dev/shm
.host:/ 233G 173G 61G 75% /mnt/hgfs

Success! You can see we now have an extra 2GB of free space! Go make yourself a cup of tea.

Sunday, July 5, 2009

Ant, SCP and EC2

I've have had to deal with a strange set of circumstances

1. No ant-jsh.jar in my deployment

I got the error

BUILD FAILED

Deploy.ant.xml:57: Problem: failed to create task or type scp

Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.Scp was not found.

This looks like one of Ant's optional components.

Action: Check that the appropriate optional JAR exists in

-/usr/share/ant/lib

-/Users/alvinrichards/.ant/lib

-a directory added on the command line with the -lib argument


Do not panic, this is a common problem.

The commonest cause is a missing JAR.


This is not a bug; it is a configuration problem

Turns out that the default deployment of Ant (1.7) did not contain this jar on Mac OS-x 10.5. So I had to do two things

  1. Download the binary distribution of Ant 1.7, unpack the jar and copy ant-jsch.jar to /usr/share/ant/lib
  2. Download the implementation of the SSH java code from JCraft and copy it to /usr/share/ant/lib


2. I still can't SCP to EC2

So I know I can scp -i to this EC2 host, but the following Ant task fails

<scp localfile="dba.war"

todir="root@xxxx:/usr/java/apache-tomcat-6.0.14/webapps/"

keyfile="xxxx-Amazon-LAMP-image-keypair">

with

BUILD FAILED

/Volumes/Develop/Develop/Projects/HarpoonDeployMK9a/Deploy.ant.xml:57: neither password nor passphrase for user root has been given. Can't authenticate.

Turns out that you need the following in the SCP task for it to work with EC2

trust="yes"

passphrase="xxx"

The passphrase that worked happened to be my password for my AWS account...

Friday, July 3, 2009

End of life... Oh Amazon stop making me do work!

So, like many early adopters I have the pain of being an early adopter. The most recent is the delightful email I got from Amazon.

Dear Amazon SQS Customer,

This is a friendly reminder about the upcoming deprecation and end-of-life for the Amazon SQS 2006/2007 WSDL.

Talk about a "Dear John" letter. In the end it was not much work, just needed to download the latest version of Typica 1.5.2a and then change
import com.xerox.amazonws.sqs.Message;
import com.xerox.amazonws.sqs.MessageQueue;
import com.xerox.amazonws.sqs.QueueService;
import com.xerox.amazonws.sqs.SQSException;
to
import com.xerox.amazonws.sqs2.Message;
import com.xerox.amazonws.sqs2.MessageQueue;
import com.xerox.amazonws.sqs2.QueueService;
import com.xerox.amazonws.sqs2.SQSException;

The only problem so far is that the old version of Typica (0.8) included in the jar ch.inventec.Base64Coder.class which is need to run. I resorted to including the old Typica jar on the class path after a fruitless search for this class elsewhere.

So I'm no back running with the new WSDL and a happier Jeff Bezos.

Now I just have to rip out the code that did on demand scaling and load balancing...

Sunday, March 8, 2009

VMWare Fusion Shared Printer Fun (or three hours to print a single page)

So, this should be simple right? I have my main Mac (some 8 core mainframe thing) where I run multiple development environments and a whole host of virtual machines running various Oracle version on lots of flavors of Windows, Linix and Solaris. I have a second machine where the shared printer is connected that I wanted to print to. Yes, I could have simply moved the printer, but where is the fun in that?

So I need to print from Windows. Well this is easy right... Errr wrong. The culprit was VMware's lack of documentation and working examples. Even the web did not prove useful.

So this is what I did, your mileage may vary

  1. Ensure that your Mac can print to the shared machine. Simply try printing a page from Safari. If that does not work, then Google way to fix a "regular" printing problem.
  2. Set the Network mode on the VM to "Bridged"
  3. Reboot the VM
  4. Install the right Printer Drivers (mine was an Epson RX500)
  5. Install Apple's "Bonjour for Windows"
  6. Follow the install directions for Bonjour for Windows, accepting all the defaults
  7. ... and if you are lucky if works
I then found a video, looks like somebody at VMWare put together but its not linked from their main site. Oh, and can I have my three hours back please?

Sunday, March 1, 2009

Write it down stupid!

So I have just paid the price, lets say conservatively at 2.5 hours. The simple solution would have been to write everything down. But you never know when. As is always obvious, "when" should not been 14 months *after* you have last done something but that 20:20 hindsight for you.

The challenge? Reboot the system. Why? Well after 14 months it needed a minor refresh for Google Analytics. I guess that I have at least proved that I built something reliable! All of this took a zero downtime from the users perspective, other than a need to log in again.

So after I figured out (again) how to start and stop on instances on EC2, kick started with the right parameters and remembered all the DNS tricks I got it up and running again.

Oh, and I then took 20 minutes to write it all up with the rest of the documentation on Google Docs...


Friday, March 21, 2008

All quite on the western front?

So what exactly has been going on? Well a lot of painstaking analytics that's what. Its a bit like CSI, its all forensic fingerprinting and dna checking. I thought I would do something quite noel these days, actually spend a bunch of time checking that all the results are valid and running numerous scenarios to check the accuracy and how the solution scales. What's odd about this? Well I doing the testing rather than let customer do it. I know, this type of behavior will never catch on in the software industry, but in my own little slice of heaven, we do it old school and its all the better for it.

What does this mean for the Server Virtualization extensions? Well they are going to take a little bit longer!

Oh, and I have had some interesting chats with "our friends" on Sand Hill Road...

Monday, February 18, 2008

A fist full of VMware analytics

So the next goal for the product is VMworld Europe. I have been busy coding away to extend the analytics to cover file-system scanning to determine duplicate blocks. Its proving a bunch of interesting challenges, how to scale, how to determine duplicates across file-system boundaries and all sorts of other issues.

Final testing in progress, and those odd problems about regression bugs... but here's a first screenshot!

Monday, January 21, 2008

Oracle runs on an Intel Mac ... really!

So darn Oracle, when the hell will there be a native port to Intel Mac? I don't know, they all must be slacking around doing cool Linux and Xen stuff instead.

So I had 10gR1 running on my PowerBook G4 and PowerMac G5 and all has worked very well for some time. Somebody at some point in time thought it would be cool to support Mac and PowerPC (PPC). I get my first Intel Mac and there is no port to Intel or even any sign of it... what should I do?

Then I remembered Apple had Rosetta to emulate all those PowerPC instructions for non "universal" applications. So I first tried to install the Oracle software from scratch. No dice. Despite being Java it puked at a JNI dynamic library. Next I simply copied the existing install from my PowerBook G4 and after hacking my init.ora around (I had lost the original) and re-creating the orapw file... I have it running!

screen2.jpg

Sunday, January 20, 2008

VMware Fusion fun... not!

So thank god to Wikipedia and Google. I had been trying to run Oracle under a Linux O/S under a Virtualized Server (yes, I'm that trendy). But could not get Oracle installed. Each time it tried to create a file or directory I got

$ cd /mnt/hgfs/oel4u5ora11g
$ touch 1.1
touch: cannot touch '1.1' : Permission denied

So I had set up a Share from the VMware preferences so that the guest O/S could not a directory on my local disk (through the Preferences). I had then gone through the directory and performed a
$ chmod -R a+rwx *
But was still getting the permission denied problem. In a simple solution on Wikipedia. Simply turn the Network from NAT to Bridged... and now I have Oracle all installed...

Sunday, January 13, 2008

Blob, Binary and other Java hardships

So, what's the difference between

byte[] fred = {-122, -97, -120, 111};

System.out.println(fred.toString());
System.out.println(new String(fred));

Well, you would same they should print the same right. Sadly wrong. So this took me a day of debugging to find out why my Fact table was producing the wrong results from the Data Warehouse queries. So I tried
  • Stuffing the data into a BLOB, well its binary after all. Broke all the joins over this column
  • Converting to Hex but got different results for the same byte[] value
  • Converting to a Binary String (i.e. 1's and 0's), but seemed horribly inefficient
  • Converting to a String, like Hex got different results for the same byte[] value and was unprintable through the mysql prompt
So I ended up keeping the value as a byte[] in the Java code and then stuffing the value in a Binary column... easy when you know how. So I just need to reconcile the values I am now getting.

Wednesday, January 2, 2008

What's up?

So what's happened since the launch? Well all the normal things, keeping the site running, dealing with bugs and feedback and thinking about something new to add...

I think it has struck me and just about everybody else on the planet that Server Virtualization is going to be a real big thing in 2008. I was sitting on a cross-country flight thinking (in coach class again) and I was struck how the algorithms that I have used and applied to Databases are just as applicable to Storage and File-Systems especially if you can determine the cost savings of deploying compression and de-duplication on the storage. This is a very obvious thing to do in Server Consolidation, just how many copies of Win2k3 or XP do you need to store when you are simply changing the IP and hostname for each copy... so it got me thinking and the complier out again.

Monday, November 12, 2007

Launch Day

Launch at Oracle Open World


shapeimage_1-7.jpg
So a 24 hour period to be forgotten. I had this troubling bug, that I could not reproduce. Sometimes it would come up and sometimes it would not. It was Saturday night and I knew that I would be traveling all day Sunday. So I staged what I had and all I needed to do was to trip the DNS switch and we would be live.

I started the journey relaxing, reading this months Wired magazine. Then it came to me a possible cause of events that could reproduce the bug. I fired up my laptop and low and behold I could reproduce it. I knew that I had to be super careful, you know a last minute change. I spent the rest of the flight looking as ways of fixing it without actually changing any code.

I got to San Francisco with a plan but I had many, many things to do that night. Roughly they were

•Interview the street marketing team
•Pick up all the stuff (T-Shirts, flyers, business cards) for the give aways
•Fix the bug

I’ll talk about the marketing events in the next blog entry. So, I fixed the bug easily but then I was faced with a dilemma. So I stage it from my Laptop or do I push from the build server? Neither seem any easy choice. Was my laptop 100% setup with all the config information to push the live image, could I make the changes remotely and push on the build server?

After a couple of attempts (aka failures) I pushed the image from my laptop. It took 15 minutes or so and at last I thought I could take it easy. But I was wrong...

So what was the issue? By 1am (which by body was really saying 4am) I could not find a good reason why the code was failing to run when I ran it from my laptop on the hosted site at Amazon. I figured sleep would help.

4am I wake up, can’t sleep any longer. I try running it from a remote machine and it appears to work. Ok, then its an issue with my laptop. I add a few extra debug statement and finally narrow it down to an extra Firefox plug-in on my Laptop. It was failing when I upload a new archive. The archive got there Ok and was processed Ok, but an error was returned to the web client. Why was this different? Well is the only form in the Application that was doing an HTTP PUT, since the rest of the Application is Ajax then there were no other PUTs and GETs. The culprit? The Snap shots plug-in was mucking with the return of the HTTP GET.... grrrrrrrr.

So I thought that was the end. Then came my nightmare from DNS street. I switch the DNS entries as I had practiced. Not the best way to do this, but the easiest way... so I thought. As you know if takes time for DNS to propagate, but its pretty quick 5-10 minutes. So I switched at 8.45am. By 9am my browser on my Laptop was still pointing to the old static web page. By 9.15am it still was.... panic!

I tried my build server, and thank god it was pointing to the correct new hosted page. Figured it was a DNS propagation delay. I continue to check all day to find that my Laptop was still pointing at the old page. Holly shit I thought. Then I connected to a VPN end-point that configured DNS and vola! I could now see the hosted web page. The problem? Using the Hotel’s ISP, there was no auto-config of DNS so my laptop was using the cached entry pointing to the old IP. Once the laptop connected to a DNS server, then it got the new IP and resolved correctly.

I think I aged 10 years in those 24 hours...

Saturday, November 10, 2007

Finishing Line?

Are we there yet?


shapeimage_1-6.jpg
So the finish line, or is it the start? I’m too tired to answer but happy to get to Oracle Open World and let Joe Public answer the question. So where’s the scores on the doors? Well the good news is this is what did get done! Some amazing work was done by Dave T to put this through its paces!

It feels impressive, but really does not fell like all the late nights, lattes and other nocturnal behavior. It came down to the following

•7116 lines of Java code the the UI
•9354 lines of Java code for the Server
•2382 lines of documentation


UI running on EC2
The UI look peachy, hear seen with the EC2 instances up and running... and I did get a lot done.

Finished

But alas, there is also the wall of shame, just those things that I just was never going to get to... I especially liked the “Zoro all todo’s” a callback to older coding days gone by!

Wall of shame

Like Apollo 13, here’s my final, final check list to remember to do before launch on Monday morning... don’t forget, rocket goes bang etc.

IMG_7225.jpg

Wednesday, November 7, 2007

Private Beta Begins

So what are friends for after all...


shapeimage_1-5.jpg
So I roped up a bunch of esteemed friends and former colleagues to bash the site and give feedback... after 24 hours of battling a timing bug in the systems, that was just very painful to reproduce, I opened the gates. God help me.

Only 4 days, 1 hour and 39 minutes left to go...