August 17th, 2011 | Tags:

In the process of upgrading my dev environment to OS X Lion I discovered that Tomcat failed to start up correctly.

I discovered the following in the log files:

2011-08-15 18:06:24,605 [] INFO  o.a.catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/6.0.32
2011-08-15 18:06:24,606 [] INFO  o.a.catalina.ha.tcp.SimpleTcpCluster - Cluster is about to start
2011-08-15 18:06:24,650 [] INFO  o.a.c.tribes.transport.ReceiverBase - Receiver Server Socket bound to:/127.0.0.1:5000
2011-08-15 18:06:24,660 [] INFO  o.a.c.tribes.membership.McastService - Attempting to bind the multicast socket to /228.0.0.4:45564
2011-08-15 18:06:24,668 [] INFO  o.a.c.tribes.membership.McastService - Setting multihome multicast interface to:/127.0.0.1
2011-08-15 18:06:24,669 [] INFO  o.a.c.tribes.membership.McastService - Setting cluster mcast soTimeout to 500
2011-08-15 18:06:24,673 [] INFO  o.a.c.tribes.membership.McastService - Sleeping for 1000 milliseconds to establish cluster membership, start level:4
2011-08-15 18:06:25,675 [] INFO  o.a.c.tribes.membership.McastService - Done sleeping, membership established, start level:4
2011-08-15 18:06:25,681 [] ERROR o.a.catalina.ha.tcp.SimpleTcpCluster - Unable to start cluster.
org.apache.catalina.tribes.ChannelException: java.io.IOException: Can't assign requested address; No faulty members identified.

After some checking of my /etc/hosts file and a couple other things I found a very relevant Tomcat Cluster troubleshooting tip.

I added the following to my catalina.sh file for the JAVA_OPTS variable, and Tomcat started up as usual:

-Djava.net.preferIPv4Stack=true

Turns out it was trying to setup the Tomcat cluster on my IPv6 interface and then I assume trying to access it via the IPv4 interface. Obviously they couldn’t communicate.

I’ve never had to do this on any prior version of OS X, nor any of my Linux machines.

December 21st, 2009 | Tags:

The following may be useful for test data or if you need to get data into a table that has a timestamp column included in the primary key requirement.

Create a function that will allow you to specify a random number range (taken from the http://wiki.postgresql.org/wiki/Random_Range):

CREATE OR REPLACE FUNCTION random(numeric, numeric
RETURNS numeric AS $$
SELECT ($1 + ($2 - $1) * random())::numeric;
$$ LANGUAGE 'sql' VOLATILE;

I then used it to generate a range of timestamps for today:

select timestamp '2009-12-21' + random(0,86400) * interval '1 second' as timestamp;
September 19th, 2006 | Tags:
July 26th, 2006 | Tags:

https://www.redhat.com/archives/fedora-legacy-list/2006-July/msg00028.html

The Fedora legacy project has announced that they will discontinue errata updates starting in October. I have a few clients with servers still running 7.3 and 9. RHEL or CentOS is the currently the obvious choice to replace these old Red Hat installs.

Red Hat will provide errata for RHEL4 until February 2010 and RHEL3 is covered until October of 2008. Red Hat has stated they will support each RHEL release for 5 years.

I determined the following release dates from the RHEL listing on http://www.distrowatch.com

RHEL3: 2003/10/22
RHEL4: 2005/02/15

Comments Off
July 24th, 2006 | Tags:

Last year I migrated a large CVS repository over to Subversion. One of the issues I missed during the migration was that unlike CVS, Subversion did not automatically set new files to expand keywords such as $Id$ to the very useful string:

$Id: MySpecialClass.java 12234 2004-05-21 00:23:08Z derek $

I did some research into the problem and unfortunately there wasn’t anything on the server side I could do to force this setting on all files as they are added and checked in to the SVN repository. To automatically enable keyword substitution you must do two things.

First, uncomment the enable-auto-props = yes line in ~/.subversion/config in each users home directory.

### Set enable-auto-props to 'yes' to enable automatic properties
### for 'svn add' and 'svn import', it defaults to 'no'.
### Automatic properties are defined in the section 'auto-props'.
enable-auto-props = yes

Then you must configure the file types to which you will apply keyword substitution:

### Section for configuring automatic properties.
[auto-props]
### The format of the entries is:
###   file-name-pattern = propname[=value][;propname[=value]...]
### The file-name-pattern can contain wildcards (such as '*' and
### '?').  All entries which match will be applied to the file.
### Note that auto-props functionality must be enabled, which
### is typically done by setting the 'enable-auto-props' option.
*.c = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL

I appended ;svn:keywords=Date Author Id Revision HeadURL to the entry for .c files in ~/.subversion/config. Uncomment other file types in the file and adjust them as needed. Feel free to add new lines to the file for other source files such as .php and .java. These settings will take effect for all new files that you add to the repository.

If you happen to have existing files in the repository that need to have the keyword property set you can set it by running the command:
svn propset svn:keywords 'Author Date Id Revision HeadURL'

svn:keyword documentation

July 23rd, 2006 | Tags:

When creating or reconstructing a Linux software RAID there is a default reconstruction rate at which the RAID will be created. On RHEL the default max speed at which it will reconstruct the array is 10000 KB/sec. This setting can easily be adjusted for the impatient among us.

echo -n 500000 > /proc/sys/dev/raid/speed_limit_max

The above command will set the max reconstruction speed to 500000 KB/sec (which will essentially max out at the speed of your drives, usually in the 50MB/sec zone from my experience).

Bumping the value up will tax the disk subsystem more than the default but often it’s worth it to get that warm fuzzy of having a consistent RAID.

July 7th, 2006 | Tags:

http://www.kernelthread.com/mac/osx/arch_startup.html

This page briefly describes the sequence of events that happen when Mac OS X boots.

June 28th, 2006 | Tags:

I run OS X on my desktop (settle down now, more on this later).

The default behavior of OS X does not mount external drives at boot time. This is very frustrating. The following command will configure your mac to mount all connected disks at startup (not just upon a user logging in).

sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true

Reboot and you’ll find all your disks already mounted if you ssh in remotely (even without having logged in via the GUI).

If you want to reverse this setting just change “true” to “false” at the end of the line.

April 11th, 2006 | Tags:

For those of you interested in using CentOS instead of RHEL you don’t need to reinstall. By following these instructions you will convert an existing RHEL4 server over to CentOS 4:

I downloaded the following files from a CentOS mirror into an empty directory:

centos-release-4-2.1.i386.rpm
centos-yumconf-4-4.3.noarch.rpm
python-elementtree-1.2.6-4.i386.rpm
python-sqlite-1.1.6-1.i386.rpm
python-urlgrabber-2.9.6-2.noarch.rpm
RPM-GPG-KEY-centos4
sqlite-3.2.2-1.i386.rpm
yum-2.4.0-1.centos4.noarch.rpm

Then ran:

rpm –import RPM-GPG-KEY-centos4
rpm -e –nodeps redhat-release
rpm -Uvh *.rpm

then

yum upgrade

February 16th, 2006 | Tags:

One of my clients purchased a dedicated server with 2 hard drives (very common configuration these days). Unfortunately their provider can’t/won’t configure their server to use software raid. My suggestion was to use the 2 matching drives in a software raid-1 configuration, but I’ve never remotely setup software raid after a server was already up and running.

Warren Togami provides a very detailed howto on remotely migrating 2 matching hard drives running Linux to a software RAID-1 configuration:
http://togami.com/~warren/guides/remoteraidcrazies/

This server was running RHEL4 and the above process worked great for me. I do have some notes that I’ll be sending back to Warren:

  • Step 5) My first drive was setup to use 255 heads whereas hdc was configured to use 16. I ran “sfdisk -H 255 /dev/hdc < partitions.txt" instead of "sfdisk /dev/hdc < partitions.txt" to reconfigure the 2nd disk to use 255 heads just like hda.
  • Step 25) Shouldn’t the commands for hdc be referencing (hd1) and (hd1,0) (where appropriate)?
  • Step 26) It says to most importantly change the root setting back to (hd0,0), yet the example still shows (hd1,0).
  • Step 27) Attempting to run “mdadm -A -s” resulted in a “mdadm: No arrays found in config file” error message. I was able to get rid of this error by creating /etc/mdadm.conf as listed in Step 22 (even though it says RHEL4 no longer requires that file, it seemed to help out in my situation).

Without Warren’s document it would have taken me much longer to figure out the best way to get this done remotely. I’m usually spoiled in that I have hardware raid on most machines and get to partition things just as I wish when I install them on-site.