Richard Martin's Blog

Archive for January, 2009

Mapserver on CentOS install guide

by Richard Martin on Jan.16, 2009, under GIS

I’ve been promising myself I’d sort this out for the greater good but over a year…. so here goes….

If you are even more lazy than me then install HostGIS – Gregor will save the day…. it’s the best install of GIS stuff I’ve ever seen….

But onto CentOS and Mapserver etc…..

Leave a Comment : more...

Real time replication for linux and PostgreSQL

by Richard Martin on Jan.16, 2009, under Linux admin, PostgreSQL

I’ve been playing with this for years.  Nothing works without major work – OK I’m lazy.  Now I can spend $500 and get pretty good replication for my linux servers, single windows server, and all the code, stuff and my precious PostgreSQL databases – at last.  I love Bucardo for great FREE replication and now I know how it works I’ll be using all over the place but if you want an easy life and good sleep check out R1 software

Boy, it’s made my life a lot easier…….

unless you don’t backup your CDP linux backup software database….. and then you lose ALL your backups…. so if you use CDP backup software backup your /usr/r1soft directly ALL the time…. if that directory gets corrupted – you’re screwed….

Leave a Comment : more...

PostgreSQL replication with Bucardo HOW-TO

by Richard Martin on Jan.14, 2009, under PostgreSQL

To setup Bucardo on a server as a multi-master

All the code and stuff is on Main server – the other server just listens…. so it does not need any “config”

To install (on the main server):

As root:
yum install postgresql-pl.x86_64
cpan
install Bundle::CPAN

then install the required Perl modules with
install DBI etc…

To install:
as postgres in psql:
CREATE USER bucardo SUPERUSER;

on ALL target databases: (as postgres)
createlang plpgsql DATABASE

as postgres in psql:
CREATE DATABASE bucardo OWNER bucardo;

as bucardo in psql:
CREATE LANGUAGE plpgsql;
CREATE LANGUAGE plperlu;

as postgres:
psql -f bucardo.schema -U bucardo bucardo

To make importable SQL files you can to save you some typing:
(inside psql)
\t
\o filename.sql

RUN A SQL QUERY and the output goes to the filename.sql
you can then just \i the files

RUN THE SQL for INSERTS and LINKS

To setup the replication and get it all going:
as bucardo on the main server:
INSERT INTO db(name, dbname, dbhost, dbuser)
VALUES ('main-server','DB_NAME','nnn.nnn.nnn.nnn','DB_USER');
INSERT INTO db(name, dbname, dbhost, dbuser)
VALUES ('other-server','DB_NAME',' nnn.nnn.nnn.nnn','DB_USER');

INSERT INTO dbgroup(name) VALUES (’remote_dbs’);
INSERT INTO dbmap(db,dbgroup) VALUES (’REMOTE_DB’,'remote_dbs’);

To generate the inserts you need: as user DB_USER

\t
\o tables.sql

This gives you a list of all tables you (probably want to replicate):
select 'INSERT INTO goat(db, tablename, pkey, pkeytype, standard_conflict) VALUES(\'main-server\', \'' || relname || '\', \'id\', \'int\', \'source\');'
from pg_class, pg_user
where usesysid=relowner and
(relkind ='r' or relkind='s') and (usename ='DB_NAME') and
(relkind !='i' or relname !~'^xinx')
order by relname;

\o

** MAKE SURE YOU REMOVE ANY REFERENCES TO BUCARDO ** – I just delete them by hand

then as user BUCARDO

(continue reading…)

1 Comment : more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Archives

All entries, chronologically...