Posts

Showing posts from August, 2014

PostgreSQL and ElasticSearch

Recently i had to evaluate ElasticSearch for a possible installation, elasticsearch is basically a search server that provides a distributed full-text search engine using a restful web interface, stores documents in json, it is written in java it is fast and really works out of the box with almost minimum effort. After the installation, it's just reading the documentation and adding / searching documents, I didn't really experiment much with searching but the API looks really good. One interesting question that i had to answer was about connectivity with postgres, and how to maintain a table in both datastores and that's what this post is all about. The first (fast and easy) answer here was rivers , it creates a jdbc connection with another datastore and based on a query it can pump data from any database table. It is available for postgres, twitter, mongo etc.. Because its jdbc its relatively slow and elasticsearch will (re)pump the data once every restart so pay ext

PostgreSQL Bi-Directional Replication

A while ago I wanted to explore the options i had for multi master replication in postgres, I have previously worked with Oracle MMR and to be honest i don't like the idea of mmr, mostly because of the all conflicts that you sometime get, most of the times these conflicts are easy to resolve though and mmr, or in our case BDR can be a very nice way to scale up your database writes. So, while searching i came across a project called postgresql BDR (bi-directional replication) developed by 2ndQuadrant , it allows users to create a geographically distributed asynchronous multi-master database using Logical Log Streaming Replication based on the changeset extraction feature introduced in PostgreSQL 9.4. This post is about showing how to set this up. For this setup i used 2 debian VMs (debian-7.5.0-amd64-netinst.iso) the extra packages i installed were : git, mc, joe,sudo, curl, libreadline-dev, zlib1g-dev, bison, flex (by the way, comments about joe wont be tolerated !!) With