Monday, September 29, 2008

Suddenly mysql won't start

Suddenly is a bit of an exaggeration. This happened on my desktop -- I use mysql on my laptop almost daily, but only once every few months my desktop. They are similar environments: latest Mac OSX 10.5 patched intel based macs. The mysql on the desktop was transferred from my previous PowerPc based desktop, but has been used a few times since the transfer.

In any case, the normal startup action
sudo /usr/local/mysql/bin/mysqld_safe



failed with the following output.


Starting mysqld daemon with databases from /usr/local/mysql/data

/usr/local/mysql/bin/mysqld_safe: line 395: /usr/local/var/: Is a directory


/usr/local/mysql/bin/mysqld_safe: line 401: /usr/local/var/: Is a directory


STOPPING server from pid file /usr/local/mysql/data/rdf-8-Tower.local.pid

tee: /usr/local/var/: Is a directory

080910 15:39:05 mysqld ended

tee: /usr/local/var/: Is a directory



At this point I said to myself "well this hasn't been upgraded in a while, I should upgrade mysql" !!bad idea!!


The upgrade didn't solve the problem. After tracing through the script in more detail I did a


sudo ./my_print_defaults



which reminded me that


Default options are read from the following files in the given order:

/etc/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf




/etc/my.cnf contained



[mysqld]

log = /usr/local/var/mysqlLOG.log

#If no specific storage engine/table type is defined in an SQL-Create statement the default type will be used.

default-storage-engine=myisam

max_allowed_packet = 16M

#Enter a name for the error log file. Otherwise a default name will be used.

log-error=/usr/local/var/

#Enter a name for the slow query log. Otherwise a default name will be used.

log-slow-queries=/usr/local/var/



Which I changed to



[mysqld]

log = /usr/local/var/mysqlLOG.log

#If no specific storage engine/table type is defined in an SQL-Create statement the default type will be used.

default-storage-engine=myisam

max_allowed_packet = 16M

#Enter a name for the error log file. Otherwise a default name will be used.

log-error=/usr/local/mysql_ERROR_LOG.log

#Enter a name for the slow query log. Otherwise a default name will be used.

log-slow-queries=/usr/local/var/mysql_SLOW_l_LOG.log




/usr/local/mysql/etc/my.cnf
didn't exist, nor did
~/.my.cnf

This allowed the db to start but I couldn't log in with any of the user accounts normally available (including root). It appears that using the mysql-5.0.67-osx10.5-x86.dmg file to update caused the db user information to get hosed.



Fortunately I'm pretty neurotic about backups and so I easily recovered just by copying /usr/local/* from my last backup.


NOTE: this backup was to a separate disk performed using SuperDuper -- TimeMachine isn't going to get files in /usr (which helps explain why the disk space used by TimeMachine is smaller than I expected).

Monday, September 15, 2008

Seam on Amazon EC2

I just completed putting up a demo of my seam work on Amazon Web Services EC2 service. I primarily did this to ground my advocacy of EC2 as a good option for small biotechs that may need occasional bursts of compute power but have neither the cash to buy adequate servers for peak compute load nor the staff to maintain them.

I thought that putting up my jboss/seam/mysql demo would also be sufficiently non-trivial to give me a good feel of what it is like.

There are similarities between EC2 and other virtualization options (EC2 is based on XEN after all).

The core differences in my mind revolve around having S3 as a backing store. Since S3 is on Amazon's servers you need to pay more attention to security keys etc.

My recommendation is the go through the Getting Started Guide -- even to the point of saving a modified image. This will assure that you have the proper accounts set up both on EC2 and S3 and you have a bucket set up on S3 for storing your image.

I found it easiest to create a bucket using the Python examples -- even though I have never done much more than a "hello world" program in python (yes one that consists of
#!/usr/bin/env python
print "Hello World"
). The python code is the most self contained and required the fewest downloads of ancillary libraries in my environment (Apple OSX 10.5.4)


Building and saving an image takes a while -- I would recommend doing a reboot of your virtual machine to make sure that all of the changes take hold (boot processes start as designed etc.).

Not to overstate the obvious, but the image that you start with has a tremendous impact on the time it takes you to get up and running. I settled upon an image that already had mysql5, jboss 4.2.2 installed, and it made things much easier. In general I didn't feel that the images were particularly well documented. Not being that familiar with Fedora I thought that the difference bettween the Fedora-core-4 and fedora-core-8 was how many CPU cores they were optimized for, not the revision number. My initial foray with the fedora-core-4 image stopped when I realized that it had mysql4 rather than mysql 5.

All in all the experience wasn't too bad (I don't think that I could ever call one of these experiences "good" -- if it were good I would just be able to click a "do it" button that would do exactly what I wanted), and would have been much better if I hadn't "lost my keys".