Archaeology Blogs

You are here : Connect » Archaeology News and Jobs » Archaeology Blogs
Online Archaeology



Archaeology Blogs
Minimize
ArchaeoGeek
Failover with PgPool

Attentive readers (or maybe just me) will recall a post I did a few months ago that outlined how to set up streaming replication with postgresql 9.0. Even more attentive readers will recall a big caveat in the post, around the need for additional software to trigger the failover from the Primary database server to the Secondary, and the necessary changes to IP addresses and such like.

I’m now going to introduce one method of handling this, in such a way that the end users hopefully don’t notice, or need to change their database connections. The package I’m going to talk about is PgPool, which is a very powerful middleware package for PostgreSQL, doing load balancing and connection pooling as well as handling failover. It is only available for linux at present, unfortunately.

The basic premise for using PgPool for failover is that your client software packages connect to PgPool as if it was the database. They connect in exactly the same way, in other words using an IP address, Port, Username, Password and Database name. The only difference is that the IP address and Port are the ones for PgPool rather than the database. In the event that the primary database server fails, PgPool handles the automatic promotion of the secondary server, and because the IP address hasn’t changed, the client (hopefully) doesn’t notice.

You can find some extremely comprehensive instructions for setting up PgPool in a number of different configurations on the website so I won’t go through them here. I went for this approach, which outlines setting up three servers- one to hold pgpool, one to be the primary database server, and one to be the secondary. The install is fairly complex, for example you need to be able to setup passwordless ssh between the servers so that they can communicate securely with each other.

I’ve noted some of the gotchas that caused me some issues below. They may not all be relevant to your setup, and will not make the blindest bit of sense unless you read the instructions first:

  • You will need to configure your database servers to use Hot Standby and Streaming Replication rather than Warm Standby.
  • Install Postgresql-server-dev-9.x (substitute the correct version of postgresql) on each of your servers to ensure that PgPool picks up the correct version of all the environment variables it needs.
  • You need to run install_functions.sh in each of your databases. To do this properly you may need to create a postgresql user called “root” so that when you run the command ‘sudo ./install_functions.sh’ it runs the enclosed psql commands without problems. Alternatively edit install_functions.sh to use the correct psql credentials for your environment.
  • You need to be able to use passwordless ssh between your three servers as either the database user or the user that your webserver runs as (if you’re using the web interface PgPoolAdmin). In my case, the webserver is apache, which tends to use the username ‘www-data’. The easiest approach is to create ‘www-data’ users on each of the servers, but you can configure ssh to use a different user instead. Whatever you do, test to make sure that the servers can all communicate with each other!
  • Test out the shell scripts for creating the basebackup and failover manually- this will show you any errors relating to permissions, usernames and such like. These will need to be tested (and possibly edited) on both database servers. I had also had to edit pgpool_remote_start to include the correct location of the pg_ctl binary- this appears to be distribution-dependent in linux.
  • The log files are your friends! When testing the web interface for connecting and disconnecting to servers, promoting to primary, or recovering, watch the log files on each database server using ‘tail -f’ to see what actually happens.
  • PgPool is set up by default to use port 9999, but you should change that to the default 5432, if you have no other install of postgresql on your PgPool server. This will avoid problems if you have client software that is not configured to use a non-default port.

Having set all of this up, my next plan is to include some email functionality in failover.sh so that it fires out an email to the database administrator when it’s triggered. Whilst it’s nice to know that all of this happens silently, it would also be useful to know there’s a problem! Note that I have seen this approach outlined in great detail somewhere out there on the internets but I can’t find the post right now. If and when I do, I’ll edit this post to include the link.

19 Jun 2013
Theoretical Structural Archaeology
Professor Wallace-Hadrill interviewed about Herculaneum at Ideas Roadshow
Theoretical structural archaeology is about understanding the evidence of ancient built environments, and previously I have written about the importance of those sites ‘frozen in time’ by some disaster preserving buildings and content in situ.
For the Roman world, Herculaneum and Pompeii give us that unique insight, a level of detail, unimaginable in conventional archaeology, which has become central to our understanding of the period.  While we are familiar with plaster body castes, dramatic reconstructions, and looming clouds of volcanic death, quite what this really means to archaeology, archaeologists and everybody else is a lot more complex, nuanced, and interesting.

A Serous insight into the archaeology of the built environment [and why it’s important].
In the latest edition ofIdeas Roadshow, Howard Burton gives us an extraordinarily insightful interview with Professor Andrew Wallace-Hadrill about the world of Herculaneum present and past.  This is a subscription service, so they want your money, but in return they offer an opportunity to spend quality time with interesting people talking about what they know best.  Professor Wallace-Hadrill effortlessly blends the latest insights into the archaeology, with its long and complex relationship with local society, down to the present day issues of conservation, presentation, and exploration. [This is a Preview - but at the moment you can watch it for Free!].
While the individual problems of the site are those familiar to most archaeologists in some form, the scale and range of issues at sites like Herculaneum make it something of  a macrocosm for archaeology as a whole; it is the subject at its most potent, complex, and deeply entangled in the wider issues of society.  If archaeology is to endure in these difficult times, it is important that what archaeologists do in the widest sense, as well as how they think, is readily available to be understood at a level beyond that of the average the television documentary. 
The Ideas Roadshow is presented in an interview format, so you are obliged to listen and think about what is being said without the distraction of images or the need of a visual narrative.   I enjoyed it for free, it presented a rare opportunity to get an insight into not just Herculaneum, but also archaeology on an executive level, where it is very “real”, and concerned with contemporary issues.  The Professor is an archaeologist with passion, and he is intelligently and unobtrusively interviewed about things that I found interesting, but this is not a review, just a recommendation. 

Picture credit;  

07 Jun 2013
Past Horizons
British archaeologists fight with Italian farmer to save ancient aqueduct
In January father and son team Edward and Michael O’Neill discovered the headwaters of the aqueduct, which was built by the Emperor Trajan, hidden beneath a crumbling 13th century church north of Rome. A sophisticated example of Roman hydraulic engineering, the aqueduct, known as the Aqua Traiana, was inaugurated in 109AD and carried fresh water [...]
06 Jun 2010
BAJR Blog
All change!
As you may have noticed, BAJR Blogging has remained unloved since December. This is because of the shiney new BAJR Federation site… http://www.bajrfed.co.uk get along there and enjoy…  with news, galleries and forum to keep you up to date and … Continue reading
09 Feb 2010
Online Archaeology Blog
OPEN ARCHIVE - a new web based system for accessing our past
The wealth of information gathered by local archaeological groups and societies on excavations, surveys and documentary research is one of the important sources of data for the study of archaeology in the UK. Currently, this archive of British archaeology is stored locally, within libraries and local history centres as well as with the originating group [...]
16 Sep 2009
Archaeology Blogs
Minimize

This is an aggregated collection of entries from archaeology blogs. The list is comprised of blogs from:

  • Past Horizons - written by Maggie and David (BAJR)
  • BAJR - written by David (BAJR)
  • ArchaeoGeek - written by Jo Cook, Information Systems Coordinator, Oxford Archaeology
  • Online Archaeology - written by Steve White
  • Theoretical Structural Archaeology - written by Geoff Carter

If you want to nominate a blog to be included in this aggregated list please get in touch.

Go to email Go to delicious.com Go to digg Go to technorati Go to reddit Go to stumbleupon Go to facebook Go to newsvine Go to simpy Go to google bookmarks Go to yahoo bookmarks Go to yahoo myweb Go to ask Go to slashdot Go to rawsugar Go to mister-wong Go to backflip Go to diigo Go to tailrank Go to live Go to twitter Go to fark Go to blogmarks Go to linkagogo Go to wink Go to ma.gnolia Go to bluedot Go to netvouz Go to blinklist Go to sphinn
Copyright 2012 Online Archaeology