The notes for this have been sitting on my computer for almost 6 months, but a comment from today spurred me onto editing, updating, and posting them. Corosync is a messaging layer used for high-availability. It serves essentially the same purpose as Heartbeat, but appears to be the project that will supersede it. Currently, it… Continue reading Installing Corosync on EC2
Adding Swap Space to an EC2 Instance
The t1.micro instance comes with only 602MB of memory. Especially under high load, it is quite easy to deplete the available memory – and since no swap space is enabled by default, this can quickly lead to a server becoming unresponsive. Swap space can also allow the kernel to move unused data out of memory,… Continue reading Adding Swap Space to an EC2 Instance
Shrink EBS Root
My EC2 instances are setup to have only the operating system and program files on the root volume, with all other data (logs, mail, etc.) on a second EBS volume. This leads to a very stable root volume, which sees a minimum of changes. Fully configured, my root volume (using Amazon’s Linux) is 1.2GB. The… Continue reading Shrink EBS Root
Capturing Termination Signals in PHP
Consider the scenario of a PHP script which can be run for a period of time, stopped, and continue its task later on. A common necessity for such a script may be to detect when the script is terminated, and perform some functions at that time. This can be accomplished by having the script capture… Continue reading Capturing Termination Signals in PHP
Installing ApacheBench without Apache on Amazon’s Linux
Having recently switched to a setup with only nginx (and no apache), I found myself wanting to run some tests. As nice as siege is, I rather like ApacheBench (ab). However, I really didn’t want to install all of Apache just to get ab. Quick and Easy Way On Amazon’s Linux, the ab binary can… Continue reading Installing ApacheBench without Apache on Amazon’s Linux
Producing Hydrogen Gas using Sodium Hydroxide and Aluminum
One of my favourite chemistry demonstrations is the combustion of hydrogen in a balloon. It has all the qualities desirable in a flashy experiment, and the actual execution is exceptionally easy – the difficulty, however, comes down to obtaining the hydrogen gas if none is available. This procedure is meant to be conducted in a… Continue reading Producing Hydrogen Gas using Sodium Hydroxide and Aluminum
Missing mail command on Amazon’s Linux
I recently noticed that the mail command is not available by default on the latest version of Amazon’s Linux AMI (v2011.09). This functionality is available in the mailx package, which can be installed with the following: yum install mailx
Connect to Amazon’s Linux via WinSCP as root
SCP offers a number of advantages over FTP, not the least of which include no setup (you don’t need an FTP server) and increased security. However, when setting up a server, it can be rather inconvenient to be unable to save a file to most directories. The simplest solution, really, is to just upload the… Continue reading Connect to Amazon’s Linux via WinSCP as root
Starting Varnish – Amazon’s Linux
I decided to install the new version of Varnish (3.0.1) using the Varnish repository (instead of amzn repository). The installation progressed without issue (you do need to override the default priorities of the repositories though), however, I ran into an issue trying to start Varnish. Every time I tried to start Varnish I would simply… Continue reading Starting Varnish – Amazon’s Linux
Showing the Firebug icon
While it is easy enough to use F12 to display Firebug in Firefox, I just like the status bar icon. Unfortunately, it has been hidden in the last few releases of Firebug. To display it, open about:config, and set extensions.firebug.showStatusIcon to true.
Building an Nginx RPM on Amazon’s Linux
If no customizations are desired, a far simpler way to get the RPM, than that outlined below, is to use the nginx repository, available from nginx’s download page. After deciding to change my server stack today (based on Amazon’s Linux), I noted that, despite the current version of Amazon’s Linux being hardly a few days… Continue reading Building an Nginx RPM on Amazon’s Linux
Upgrading Amazon’s Linux
Today, after looking over the changes in the new version of Amazon’s Linux AMI, I decided to upgrade (from 2011.02 to 2011.09). After running yum upgrade, I ran into an error (below) with compat-openldap. Error: Package: compat-openldap-2.4.19_2.3.43-15.11.amzn1.i686 (@upgrade-updates/2010.11) Requires: openldap = 2.4.19-15.11.amzn1 Removing: openldap-2.4.19-15.11.amzn1.i686 (@upgrade-updates/2010.11) openldap = 2.4.19-15.11.amzn1 Updated By: openldap-2.4.23-15.13.amzn1.i686 (amzn-main) openldap = 2.4.23-15.13.amzn1… Continue reading Upgrading Amazon’s Linux
Physical Activity Ratios
Having recently been asked about calorie usage, and following an unsuccessful online search for a table of PAR values, I have reproduced, below, one I had in my physiology notes from a few years ago. Using PAR allows a much more accurate calculation of TEE or PAL than the typically limited ‘activity levels’ (e.g. sedentary,… Continue reading Physical Activity Ratios
Optimize all MySQL Tables
A one-liner to optimize all MySQL tables, in all databases. Be advised that running optimize on InnoDB does a ‘recreate and analyze’. Run as root in the example below. mysqlcheck -o -u root -p –all-databases