Archive for the ‘IT & Administration’ Category

Cassandra is a highly scalable, eventually consistent, distributed, structured key-value store. It’s an alternative to SQL if you don’t need relational data structures. The best part is it’s super fast, and distributed. The worst part is there’s not much documentation or community, at least compared to MySQL. So, I’m doing my small part to contribute to Cassandra. Here’s how I installed Cassandra on Ubuntu 8.04.2 LTS (hardy), but these directions should work on pretty much any Linux distro.

1. First upgrade your software as is with the following two commands (just for good measure):

sudo apt-get update
sudo apt-get upgrade

2. Now, open up your Debian package sources list with Nano for editing using the following command:

sudo nano /etc/apt/sources.list

3. Next, add the following sources to your /etc/apt/sources.list file.

deb http://www.apache.org/dist/incubator/cassandra/debian unstable main
deb-src http://www.apache.org/dist/incubator/cassandra/debian unstable main

After you add these two lines, press cntrl+X to close Nano. It’ll ask “Save modified buffer?” Press Y. Press Enter when Nano asks “File Name to Write.”

4. Run the update to install Casandra with this command:

sudo apt-get update

5. ERROR! At this point you receive an error similar to this:

W: GPG error: http://www.apache.org unstable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F758CE318D77295D

6. Use the following three commands to ignore the signature error, and continue installing:

NOTE: You must replace the key value ‘F758CE318D77295D’ with the key value you received in your error message.

gpg --keyserver wwwkeys.eu.pgp.net --recv-keys F758CE318D77295D
sudo apt-key add ~/.gnupg/pubring.gpg
sudo apt-get update

7. Install Cassandra:

sudo apt-get install cassandra

8. Next you need to change Cassandra’s default port number from 8080 to something else, because the 8080 port typically conflicts with SSH terminal connections. Use Nano to open up the Cassandra configuration file using the following command:

sudo nano /usr/share/cassandra/cassandra.in.sh

9. Then change the port number 8080 on the following line to 10036, and save the file:

-Dcom.sun.management.jmxremote.port=10036 \

10. Start Cassandra with the command:

/etc/init.d/cassandra start

Once you have Cassandra running, test it with Cassandra’s command line tool CLI. Use the example found on the Cassandra Wiki.

First upgrade your software as is.

>> sudo apt-get update

>> sudo apt-get upgrade

Then add the following to your /etc/apt/sources.list file.

>> sudo nano /etc/apt/sources.list

deb http://http.us.debian.org/debian stable all
deb http://security.debian.org/ stable/updates main contrib
deb http://packages.dotdeb.org/ stable all

Finally run the update to install PHP 5.2.9.

>> sudo apt-get update

>> sudo apt-get install php5-cli

>> sudo /etc/init.d/apache2 restart

If you’re running Mac OS X and Boot Camp you may need to increase or decrease the size of your Microsoft Windows Boot Camp partition, depending on what great videos games are out for Windows at the time. ;)

To accomplish this task without losing all your Windows data you need 3 things.

  1. Mac OS X 10.5 (Leopard)
  2. An HFS+ Mac-formatted external drive
  3. Winclone

To decrease the size of your Windows partition use the following steps.

  1. Make a backup of your Boot Camp partition from Windows. (optional)
  2. Run Winclone.
  3. In the “Tools” drop down click “Shrink Windows (NTFS) file system.”
  4. Follow the onscreen instructions.
  5. Wait… it takes awhile.
  6. In Winclone create an “Image” to your Mac-formatted external hard drive.
  7. Use Boot Camp Assistant to return your drive to a 100% Mac-formatted partition.
  8. Use Boot Camp Assistant to make a new Boot Camp partition larger than the file size of your “shrunk” Windows partition image, but smaller than your original Boot Camp partition size.
  9. When it asks for Windows disk, quit Boot Camp Assistant.
  10. Run Winclone again and “Restore” your Windows image to the new partition.

To increase the size of your Windows partition use the following steps.

  1. Make a backup of your Boot Camp partition from Windows. (optional)
  2. Run Winclone.
  3. In Winclone create an “Image” to your Mac-formatted external hard drive.
  4. Use Boot Camp Assistant to return your drive to a 100% Mac-formatted partition.
  5. Use Boot Camp Assistant to make new Boot Camp partition larger than your original partition size.
  6. When it asks for Windows disk, quit Boot Camp Assistant.
  7. Run Winclone again and “Restore” your Windows image to the new partition.

Kind of a pain, but it’s doable. I’ve altered my Boot Camp partition numerous times using the methods above.

Recently one of my clients was having some issues with a CGI script they purchased. They’re running IIS on all of their servers, and oddly, this purchased script worked on one of their servers but not the other. On the server where the script wasn’t running correctly, IE displayed “Content-type: text/html” at the top of the CGI page. If I remember correctly FireFox displayed the entire markup of the page in text.

After quite a bit of research I found this excellent Perl for Win32 FAQ and learned that when you setup Perl for IIS you have two options, you can use “Perl for Win32″ or you can use “PerlIS.” In my client’s case, they were running Perl for Win32 on the server with the working script and PerlIS on the server with the broken script.

Perl for Win32 = perl.exe
PerlIS = perlis.dll

They are both the same version of Perl, and both come included when you download Perl for Windows. However, even though they are the same version of Perl, they are different “interpreters.”

Perl for Win32 and PerlIS are mostly alike, but PerlIS requires that your scripts include the HTTP response status line as well as all headers for the response. Using Perl for Win32 you only need to specify the headers.

PerlIS is about two times faster than Perl for Win32. However, most CGI script that you purchase, or download for free, do not specify the HTTP response status line. This is because most scripts are not written for PerlIS. (Ok, I can’t backup that claim, but that seems to be the case in my experience.)

If your Perl scripts are displaying the content-type at the top of the page, try configuring your IIS server to run Perl using perl.exe instead of perlis.dll.

I know this is probably common knowledge to Linux and Unix geeks. But every time I need to remove a directory with files in my NearlyFreeSpeech.Net SSH terminal I end up having to google for the command. So here it is for anyone else who’s out there googling!

rm -r -f YourDirectory

rm = remove / delete
-r = recursively deletes the directory and all files in it, including subdirectories
-f = will not ask for confirmation before deleting