Thursday, February 14, 2013

Building mysql 5.6.10 on Amazon Linux AWS

This is just a quick record of my attempt to build the new GA version of mysql 5.6.10 on an amazon linux instance on aws.

Background: 


Output from uname -a:

Linux dz1 3.2.36-1.46.amzn1.x86_64 #1 SMP Mon Jan 14 04:42:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux


Prerequisites: 


Use "sudo yum list installed" for each of these to see if they exist, or just install using "sudo yum install" :


make.x86_64
cmake.x86_64
ncurses-devel.x86_64
libaio-devel.x86_64
gcc47-c++.x86_64
bison.x86_64

I created a mysql user and an installation directory in /opt/mysql. That is where I copied the downloaded source file mysql-5.6.10.tar.gz. Exctracting creates the new mysql-5.6.10 subdirectory:

Created a "build" subdirectory:


cd /opt/mysql/mysql-5.6.10
mkdir build.dz
cd build.dz

Ran a script with this in contents to configure. Note that TMPDIR is the only environment variable set. The flags are passed in on the command line now:

#!/bin/bash
TMPDIR=/tmp
cmake /opt/mysql/mysql-5.6.10  \
    -DBUILD_CONFIG=mysql_release \
    -DENABLE_DOWNLOADS=1 \
    -DCMAKE_INSTALL_PREFIX=/opt/mysql/mysql-5.6.10-amazon.x86_64\
    -DWITH_INNODB_MEMCACHED=ON \
    "-DCMAKE_C_FLAGS=  -m64" \
    "-DCMAKE_CXX_FLAGS= -m64" \
    -DSYSCONFDIR=/etc


That produced an error:

-- Successfully downloaded http://googlemock.googlecode.com/files/gmock-1.6.0.zip to /opt/mysql/mysql-5.6.10/source_downloads
CMake Error: Problem with tar_extract_all(): Invalid argument
CMake Error: Problem extracting tar: /opt/mysql/mysql-5.6.10/source_downloads/gmock-1.6.0.zip
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/mysql/mysql-5.6.10/build.dz



After running the "cmake" script once, I emptied the build.dz subdirectory, then did this before re-trying the cmake command:


cd /opt/mysql/mysql-5.6.10
unzip /opt/mysql/mysql-5.6.10/source_downloads/gmock-1.6.0.zip

.... re-ran the cmake command as shown above.


Running make  took about 8 hours on a micro instance. :

nohup make > log.make 2>&1 &


Then run the tests:

make test

make install

I ran the extended tests too:

cd /opt/mysql/mysql-5.6.10/build.dz/mysql-test
nohup ./mysql-test-run > log.mysql-test-run 2>&1 &

which failed with this error:


Can't locate Time/HiRes.pm in @INC (@INC contains: lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at lib/mtr_report.pm line 440.
BEGIN failed--compilation aborted at lib/mtr_report.pm line 440.
Compilation failed in require at lib/mtr_cases.pm line 27.
BEGIN failed--compilation aborted at lib/mtr_cases.pm line 27.
Compilation failed in require at ./mysql-test-run line 95.
BEGIN failed--compilation aborted at ./mysql-test-run line 95.

So I installed the hi res package. 


sudo yum install perl-Time-HiRes


The mysql-test-run suite failed again due to a truncation error with the mysqlhotcopy tests. I fixed this by editing /opt/mysql/mysql-5.6.10/mysql-test/include/mysqlhotcopy.inc to change the varchar(20) column datatypes to varchar(30).










Saturday, November 17, 2012

Recovering an Amazon EC2 instance from a snapshot

If you have Amazon EC2 instances, it might be a good idea to pause and make sure you have a good backup and recovery plan.  Amazon makes it pretty easy, but it is still worth practicing.

Today I spent some time creating snapshots of one of my Amazon Linux instances, and then using them to launch new instances. This took several tries before I got it to work.  The error I stumbled through was:

EXT3-fs: sda1: couldn't mount because of unsupported optional features (240).

To resolve this, I found that the key is to make sure the Kernel ID’s match up between the original instance and the new AMI Image. All of the steps below are done in the EC2 Management Console.

  • When you create snapshots, it is probably a good idea to keep the original Kernel ID and architecture ( i386 / x86_64)  in a tag on the snapshot. Months from now you'll need that info.
  • To create a new instance from an existing snapshot, highlight the snapshot and select the “Create Image” button.
  • In the “Create EBS image from snapshot” pop-up, be sure to select the correct architecture first, and then select the Kernel ID. The select list of Kernel ID’s depends on the architecture. Also, I selected the “EBS Volumes” Radio button on the “Block Device Mapping Section” .
  • After you create the new AMI, be sure to also specify the correctKernel ID when launching new instances of it.

Friday, October 12, 2012

Zabbix 2.0 Documentation in PDF format

I've used OpenOffice.org to convert the Zabbix 2.0 online documentation to a pdf format.

It can be downloaded here: Zabbix2-0Manual.pdf