Custom Search

Friday, January 29, 2010

Google Collections SVN repository

Google Collections 1.0 was released recently towards the end of December 2009. While very useful from an API and performance perspective, the API had quite an amount of surprises / deprecations / removals in its later stages ( 0.7 / 0.8 etc.) .

With 1.0 the API seems to have been stabilized and as an added benefit for those integrating with mvn - it is also available here as the mvn repository - http://google-maven-repository.googlecode.com/svn/repository/com/google/collections/google-collections/1.0/ .

com.google.collections / google-collections / 1.0 should do the trick in ivy.xml / pom.xml as appropriate.


Thursday, January 28, 2010

libevent 2.0 released

As per this update on the google developer blog , libevent 2.0 seems to be released.

For those of you new to the library - libevent provides a platform agnostic event handling library so that the user does deal with the quirks of the operating systems like Linux and Solaris and chooses the best event handling adapter present in the kernel ( Eg: In Linux, from 2.6 - epoll performs much better than poll / select . The former in O(1) in handling of connections whereas the latter group is O(n) in event handling proportional to the number of active connections at that time instant ).

More details are available in the book available here.

Specifically about the update - it seems like the developers on Windows would benefit a lot from the API changes made. I will probably write a more detailed review of the same after playing around with the software / API on various platforms and distributions.

Saturday, January 23, 2010

Resetting / Overwriting /etc/resolv.conf in EC2 instance

Creates a new EC2 instance ( CentOS ) and by default it comes with a dns resolver to the outside world.

For our purposes - we had set up an internal dns server running (bind - process 'named' on a particular host).

When we were launching our pool of servers - we wanted to make sure that the new instances fall under the same domain that we specify it to be.

We also wanted to set the nameserver of the newly created instances pointing to the internal DNS server we have to resolve the ambiguity we have.

Before making the change - the file /etc/resolv.conf was looking as follows.
# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search some.internal.aws.domain
nameserver 172.x.y.z 

where 172.x.y.z was something set by Amazon EC2 by default.

Edit /etc/dhclient.conf ( Create one , if it does not exist )
supersede  domain-name "ec2.mycompany.com" ;
prepend domain-name-servers 10.p.q.r ;my internal company dns

I also found it useful to create an Elastic IP and associate the dns server instance with the elastic ip,
and then have the prepend domain-name-servers refer to the elastic ip , instead of the internal ip.
So - even if the internal dns server fails = we can reconstruct it from another AMI and associate with the elastic ip without affecting the rest of the system.

To see the changes to /etc/dhclient , do the following

$ dhclient -r ; dhclient 

This command forcibly renews the dhcp lease that will force the new credentials from /etc/dhclient.conf to be read.

After doing this , verify /etc/resolv.conf

search ec2.mycompany.com
nameserver 10.p.q.r    ; our DNS server
nameserver 172.x.y.z  ; the one set by amzn

So that completes the process and we are good about it.



Sunday, January 17, 2010

Zookeeper build

Was trying to build Zookeeper from trunk ( 3.3.0 ) .

Came across this error  -

create-cppunit-configure:
     [exec] configure.ac:33: warning: macro `AM_PATH_CPPUNIT' not found in library
     [exec] libtoolize: putting auxiliary files in `.'.
     [exec] libtoolize: copying file `./config.guess'
     [exec] libtoolize: copying file `./config.sub'
     [exec] libtoolize: copying file `./install-sh'
     [exec] libtoolize: copying file `./ltmain.sh'
     [exec] libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
     [exec] libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
     [exec] libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
     [exec] configure.ac:33: warning: macro `AM_PATH_CPPUNIT' not found in library
     [exec] configure.ac:33: error: possibly undefined macro: AM_PATH_CPPUNIT
     [exec]       If this token and others are legitimate, please use m4_pattern_allow.
     [exec]       See the Autoconf documentation.
     [exec] autoreconf: /usr/bin/autoconf failed with exit status: 1

Installed -

$  sudo apt-get install libcppunit-dev

Ended up with ..

     [exec] .../zookeeper/src/c/configure: line 5015: syntax error near unexpected token `1.10.2'
     [exec] .../zookeeper/src/c/configure: line 5015: `   AM_PATH_CPPUNIT(1.10.2)'

Hmm.. bad times.

Friday, January 15, 2010

Installing Thrift Continued

Continuing my previous post of installing Thrift - needed to install the following obvious ones as well.

 sudo apt-get install flex bison 

And then , run ./configure once again to make sure all the libraries are linked together.

 ./configure
This should regenerate the makefiles once again, after installing flex and bison.

Installing Thrift

Checked out thrift from the trunk on my ubuntu box ( 9.10 ) .

The first step on the installation was running the program

$ ./bootstrap.sh

It failed with some errors , some fairly obvious (missing autoconf ) - some not so obvious.
The first step is to get autoconf installed.

$ sudo apt-get install autoconf

Then ran into this error.

$ ./bootstrap.sh
configure.ac:44: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:26: installing `./install-sh'
configure.ac:26: installing `./missing'
compiler/cpp/Makefile.am: installing `./depcomp'
configure.ac: installing `./ylwrap'
lib/cpp/Makefile.am:24: Libtool library used but `LIBTOOL' is undefined
lib/cpp/Makefile.am:24:   The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'
lib/cpp/Makefile.am:24:   to `configure.ac' and run `aclocal' and `autoconf' again.
lib/cpp/Makefile.am:24:   If `AC_PROG_LIBTOOL' is in `configure.ac', make sure
lib/cpp/Makefile.am:24:   its definition is in aclocal's search path.
test/Makefile.am:30: Libtool library used but `LIBTOOL' is undefined
test/Makefile.am:30:   The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'
test/Makefile.am:30:   to `configure.ac' and run `aclocal' and `autoconf' again.
test/Makefile.am:30:   If `AC_PROG_LIBTOOL' is in `configure.ac', make sure
test/Makefile.am:30:   its definition is in aclocal's search path.


The fix was to install libtool.
$ sudo apt-get install libtool


And then comes the boost libraries -

$ sudo apt-get install libboost1.40-dev libboost1.40-doc

(Your boost library version might be different from mine but you get the idea !!).