<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Richard Martin's Blog</title>
	
	<link>http://www.richardmartin.org</link>
	<description>PostgreSQL and Linux in real life - well mine...</description>
	<lastBuildDate>Sat, 01 Aug 2009 19:09:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/RichardMartinsBlog" /><feedburner:info uri="richardmartinsblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Xen installation</title>
		<link>http://feedproxy.google.com/~r/RichardMartinsBlog/~3/W3RYow78QV8/</link>
		<comments>http://www.richardmartin.org/2009/08/xen-installation/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 18:00:58 +0000</pubDate>
		<dc:creator>Richard Martin</dc:creator>
				<category><![CDATA[Linux admin]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.richardmartin.org/?p=52</guid>
		<description><![CDATA[On a PowerEdge 2950 as root:
yum install xen
install a remote Centos 5.3 image from my local mirror&#8230;
virt-install
eh&#8230; that&#8217;s it.  Rather simple.  See here for proof&#8230;.
Now for Windows Server 2003&#8230;..    Perhaps a longer post is looming&#8230;
]]></description>
			<content:encoded><![CDATA[<p>On a PowerEdge 2950 as root:</p>
<p style="padding-left: 30px;"><code>yum install xen</code></p>
<p>install a remote Centos 5.3 image from my local mirror&#8230;</p>
<p style="padding-left: 30px;"><code>virt-install</code></p>
<p>eh&#8230; that&#8217;s it.  Rather simple.  See here for <a href="http://www.howtoforge.com/centos_5.0_xen">proof</a>&#8230;.</p>
<p>Now for Windows Server 2003&#8230;.. <img src='http://www.richardmartin.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   Perhaps a longer post is looming&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richardmartin.org/2009/08/xen-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.richardmartin.org/2009/08/xen-installation/</feedburner:origLink></item>
		<item>
		<title>Replicating PostgreSQL – the easy way – with rubyrep</title>
		<link>http://feedproxy.google.com/~r/RichardMartinsBlog/~3/TYSC8fPidfI/</link>
		<comments>http://www.richardmartin.org/2009/08/replicating-postgresql-the-easy-way/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 16:36:18 +0000</pubDate>
		<dc:creator>Richard Martin</dc:creator>
				<category><![CDATA[Linux admin]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[postgresql replication]]></category>

		<guid isPermaLink="false">http://www.richardmartin.org/?p=32</guid>
		<description><![CDATA[database replication made simple - rubyrep]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a great fan of <a href="http://www.bucardo.org">Bucardo</a> for <a href="http://www.postgresql.org">PostgreSQL</a> replication&#8230;. it&#8217;s stable but quite hard to use&#8230;. if you want fire and (not) forget replication try <a href="http://www.rubyrep.org">RubyRep</a>&#8230;. awesome.  The documentation is perfect but to make it even easier, if you are testing and messing around&#8230; uninstall, then re-scan, then replicate otherwise you might get some bizarre replication errors, or foreign key contraint issues etc&#8230; anything odd, just un-install, then re-scan and replicate.  It really is full proof&#8230; well it worked for me!</p>
<p>For the cut &amp; paste brigade: (<a href="http://www.rubyrep.org/tutorial.html">RTFM</a>)</p>
<p style="padding-left: 30px;"><code>rubyrep generate myrubyrep.conf</code></p>
<p style="padding-left: 30px;"><code>rubyrep scan -c myrubyrep.conf</code></p>
<p style="padding-left: 30px;"><code>nohup rubyrep replicate -c myrubyrep.conf &amp;</code></p>
<p>Remember the <a href="http://en.wikipedia.org/wiki/Nohup">nohup</a> and the <a href="http://linux.about.com/od/glossary/l/bldef_bgprocess.htm">&amp;</a>, to background it, unless you&#8217;re actually at the console of the production server &#8211; which you probably aren&#8217;t&#8230;.  In fact stick the nohup and &amp; on the scan command too as that could take a few hours on a big DB&#8230;</p>
<p>Then <em>tail -f nohup.out</em> to watch the (lack) of output, output is normally bad &#8211; loss of connection:</p>
<blockquote><p>2009-07-31T22:22:13+01:00 Exception caught: no connection to &#8216;right&#8217; database</p></blockquote>
<p>and what not&#8230; but rubyrep will just keep going once the connection comes back up.  Perfect!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richardmartin.org/2009/08/replicating-postgresql-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.richardmartin.org/2009/08/replicating-postgresql-the-easy-way/</feedburner:origLink></item>
		<item>
		<title>Installing Xen 3.4 on a Dell PowerEdge 2950</title>
		<link>http://feedproxy.google.com/~r/RichardMartinsBlog/~3/j_oq7mQ84Ks/</link>
		<comments>http://www.richardmartin.org/2009/07/installing-xen-34-on-a-dell-poweredge-2950/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 11:07:37 +0000</pubDate>
		<dc:creator>Richard Martin</dc:creator>
				<category><![CDATA[Linux admin]]></category>
		<category><![CDATA[Xen]]></category>
		<category><![CDATA[Xen virtualization CentOS]]></category>

		<guid isPermaLink="false">http://www.richardmartin.org/?p=28</guid>
		<description><![CDATA[Here goes, will it work with CentOS 5.3 and Windows Server 2003 guests?  This is what I did and the general setup&#8230;.
]]></description>
			<content:encoded><![CDATA[<p>Here goes, will it work with CentOS 5.3 and Windows Server 2003 guests?  This is what I did and the general setup&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richardmartin.org/2009/07/installing-xen-34-on-a-dell-poweredge-2950/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.richardmartin.org/2009/07/installing-xen-34-on-a-dell-poweredge-2950/</feedburner:origLink></item>
		<item>
		<title>trac – wiki bug tracker</title>
		<link>http://feedproxy.google.com/~r/RichardMartinsBlog/~3/lLtoLeF-OtU/</link>
		<comments>http://www.richardmartin.org/2009/06/trac-wiki-bug-tracker/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 20:24:04 +0000</pubDate>
		<dc:creator>Richard Martin</dc:creator>
				<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://www.richardmartin.org/?p=22</guid>
		<description><![CDATA[If you live in the UK and like &#8216;proper&#8217; dates use this:
PythonOption TracLocale en_GB
in your httpd.conf (between the locations)
]]></description>
			<content:encoded><![CDATA[<p>If you live in the UK and like &#8216;proper&#8217; dates use this:</p>
<p>PythonOption TracLocale en_GB</p>
<p>in your httpd.conf (between the locations)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richardmartin.org/2009/06/trac-wiki-bug-tracker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.richardmartin.org/2009/06/trac-wiki-bug-tracker/</feedburner:origLink></item>
		<item>
		<title>Mac Mini Media Centre</title>
		<link>http://feedproxy.google.com/~r/RichardMartinsBlog/~3/GnlyM0KwiGw/</link>
		<comments>http://www.richardmartin.org/2009/05/mac-mini-media-centre/#comments</comments>
		<pubDate>Sun, 31 May 2009 14:20:21 +0000</pubDate>
		<dc:creator>Richard Martin</dc:creator>
				<category><![CDATA[Mac OSX]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[media center]]></category>

		<guid isPermaLink="false">http://www.richardmartin.org/?p=17</guid>
		<description><![CDATA[Does it work?  Oh yeah&#8230;..  after much reading and then buying one I found out nothing seems to work that well.  However, Plex makes the world perfect so forget the rest and get Plex for the best media centre you can get.
My setup:
Sony 46&#8243; TV 1080p running from my Mac Mini 2.26GHz [...]]]></description>
			<content:encoded><![CDATA[<p>Does it work?  Oh yeah&#8230;..  after much reading and then buying one I found out nothing seems to work that well.  However, Plex makes the world perfect so forget the rest and get Plex for the best media centre you can get.</p>
<p>My setup:</p>
<p>Sony 46&#8243; TV 1080p running from my Mac Mini 2.26GHz Intel Core 2 Duo processor via the DVI to HDMI cable.  I use <a href="http://www.elgato.com/">EyeTV</a> from Elgato to watch live DVB broadcasts and <a href="&lt;a href=&quot;http://www.plexapp.com/&quot;&gt;">Plex</a> for all my movies, DVD&#8217;s mkv&#8217;s, avi&#8217;s &#8211; you name it.  <a href="http://www.iospirit.com/">Remote Buddy</a> makes the setup complete for the Apple Remote.   No hassle no messing, just out of the box &#8211; as it shoud be.  No skipping, no shudder, perfect sound &#8211; and a very quiet (silent) HTPC solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richardmartin.org/2009/05/mac-mini-media-centre/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.richardmartin.org/2009/05/mac-mini-media-centre/</feedburner:origLink></item>
		<item>
		<title>Clear DNS cache on Mac Leopard 10.5.7 OS X</title>
		<link>http://feedproxy.google.com/~r/RichardMartinsBlog/~3/iDOus8FYLK4/</link>
		<comments>http://www.richardmartin.org/2009/05/clear-dns-cache-on-mac-leopard-1057-os-x/#comments</comments>
		<pubDate>Thu, 28 May 2009 13:24:03 +0000</pubDate>
		<dc:creator>Richard Martin</dc:creator>
				<category><![CDATA[Linux admin]]></category>
		<category><![CDATA[flush DNS cache OS X]]></category>

		<guid isPermaLink="false">http://www.richardmartin.org/2009/05/clear-dns-cache-on-mac-leopard-1057-os-x/</guid>
		<description><![CDATA[If you mess with your DNS and need to reload the latest DNS entries clear your DNS cache with:

 dscacheutil -flushcache
]]></description>
			<content:encoded><![CDATA[<p>If you mess with your DNS and need to reload the latest DNS entries clear your DNS cache with:<br />
<code><br />
 dscacheutil -flushcache</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.richardmartin.org/2009/05/clear-dns-cache-on-mac-leopard-1057-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.richardmartin.org/2009/05/clear-dns-cache-on-mac-leopard-1057-os-x/</feedburner:origLink></item>
		<item>
		<title>Mapserver on CentOS install guide</title>
		<link>http://feedproxy.google.com/~r/RichardMartinsBlog/~3/KJQXDgjB3h4/</link>
		<comments>http://www.richardmartin.org/2009/01/mapserver-on-centos-install-guide/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 20:33:21 +0000</pubDate>
		<dc:creator>Richard Martin</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[gis centos install]]></category>

		<guid isPermaLink="false">http://www.richardmartin.org/?p=6</guid>
		<description><![CDATA[I&#8217;ve been promising myself I&#8217;d sort this out for the greater good but over a year&#8230;. so here goes&#8230;.
If you are even more lazy than me then install HostGIS &#8211; Gregor will save the day&#8230;. it&#8217;s the best install of GIS stuff I&#8217;ve ever seen&#8230;.
But onto CentOS and Mapserver etc&#8230;..
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been promising myself I&#8217;d sort this out for the greater good but over a year&#8230;. so here goes&#8230;.</p>
<p>If you are even more lazy than me then install <a href="http://www.hostgis.com/">HostGIS</a> &#8211; Gregor will save the day&#8230;. it&#8217;s the best install of GIS stuff I&#8217;ve ever seen&#8230;.</p>
<p>But onto CentOS and Mapserver etc&#8230;..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richardmartin.org/2009/01/mapserver-on-centos-install-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.richardmartin.org/2009/01/mapserver-on-centos-install-guide/</feedburner:origLink></item>
		<item>
		<title>Real time replication for linux and PostgreSQL</title>
		<link>http://feedproxy.google.com/~r/RichardMartinsBlog/~3/D9zOBcU1vkA/</link>
		<comments>http://www.richardmartin.org/2009/01/real-time-replication-for-linux-and-postgresql/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 20:28:19 +0000</pubDate>
		<dc:creator>Richard Martin</dc:creator>
				<category><![CDATA[Linux admin]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[postgresql replication]]></category>

		<guid isPermaLink="false">http://www.richardmartin.org/?p=4</guid>
		<description><![CDATA[I&#8217;ve been playing with this for years.  Nothing works without major work &#8211; OK I&#8217;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 &#8211; at last.  I love Bucardo for great FREE replication and now [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing with this for years.  Nothing works without major work &#8211; OK I&#8217;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 &#8211; at last.  I love Bucardo for great FREE replication and now I know how it works I&#8217;ll be using all over the place but if you want an easy life and good sleep check out <a href="http://www.r1soft.com">R1 software</a></p>
<p>Boy, it&#8217;s made my life a lot easier&#8230;&#8230;.</p>
<p>unless you don&#8217;t backup your CDP linux backup software database&#8230;.. and then you lose ALL your backups&#8230;. so if you use CDP backup software backup your /usr/r1soft directly ALL the time&#8230;. if that directory gets corrupted &#8211; you&#8217;re screwed&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richardmartin.org/2009/01/real-time-replication-for-linux-and-postgresql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.richardmartin.org/2009/01/real-time-replication-for-linux-and-postgresql/</feedburner:origLink></item>
		<item>
		<title>PostgreSQL replication with Bucardo HOW-TO</title>
		<link>http://feedproxy.google.com/~r/RichardMartinsBlog/~3/_wggHd2j7Z4/</link>
		<comments>http://www.richardmartin.org/2009/01/bucardo-postgresql/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 20:58:13 +0000</pubDate>
		<dc:creator>Richard Martin</dc:creator>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[bucardo replication]]></category>

		<guid isPermaLink="false">http://www.richardmartin.org/?p=1</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>To setup <a href="http://www.bucardo.org">Bucardo</a> on a server as a multi-master</strong></p>
<p>All the code and stuff is on Main server – the other server just listens…. so it does not need any “config”</p>
<p>To install (on the main server):</p>
<p>As root:<br />
<code>yum install postgresql-pl.x86_64<br />
cpan<br />
install Bundle::CPAN</code></p>
<p>then install the required Perl modules with<br />
<code>install DBI</code> etc…</p>
<p>To install:<br />
as postgres in psql:<br />
<code>CREATE USER bucardo SUPERUSER; </code></p>
<p>on ALL target databases: (as postgres)<br />
<code>createlang plpgsql DATABASE</code></p>
<p>as postgres in psql:<br />
<code>CREATE DATABASE bucardo OWNER bucardo; </code></p>
<p>as bucardo in psql:<br />
<code>CREATE LANGUAGE plpgsql;<br />
CREATE LANGUAGE plperlu;</code></p>
<p>as postgres:<br />
<code>psql -f bucardo.schema -U bucardo bucardo</code></p>
<p>To make importable SQL files you can to save you some typing:<br />
(inside psql)<br />
<code>\t<br />
\o filename.sql</code><br />
RUN A SQL QUERY and the output goes to the filename.sql<br />
you can then just \i the files</p>
<p><strong>RUN THE SQL for INSERTS and LINKS</strong></p>
<p>To setup the replication and get it all going:<br />
as bucardo on the main server:<br />
<code>INSERT INTO db(name, dbname, dbhost, dbuser)<br />
VALUES ('main-server','DB_NAME','nnn.nnn.nnn.nnn','DB_USER');<br />
INSERT INTO db(name, dbname, dbhost, dbuser)<br />
VALUES ('other-server','DB_NAME',' nnn.nnn.nnn.nnn','DB_USER');</code></p>
<p>INSERT INTO dbgroup(name) VALUES (&#8217;remote_dbs&#8217;);<br />
INSERT INTO dbmap(db,dbgroup) VALUES (&#8217;REMOTE_DB&#8217;,'remote_dbs&#8217;);</p>
<p>To generate the inserts you need: as user DB_USER</p>
<p><code>\t<br />
\o tables.sql</code></p>
<p>This gives you a list of all tables you (probably want to replicate):<br />
<code>select 'INSERT INTO goat(db, tablename, pkey, pkeytype, standard_conflict) VALUES(\'main-server\', \'' || relname || '\', \'id\', \'int\', \'source\');'<br />
from pg_class, pg_user<br />
where usesysid=relowner and<br />
(relkind ='r' or relkind='s') and (usename ='DB_NAME') and<br />
(relkind !='i' or relname !~'^xinx')<br />
order by relname;</code></p>
<p>\o</p>
<p>** MAKE SURE YOU REMOVE ANY REFERENCES TO BUCARDO ** &#8211; I just delete them by hand</p>
<p>then as user BUCARDO</p>
<p><span id="more-1"></span>\i tables.sql</p>
<p><code>INSERT INTO herd(name) VALUES ('HERD_NAME'); </code></p>
<p>To make the links: as user DB_USER</p>
<p><code>\t<br />
\o links.sql</code></p>
<p>select &#8216;\&#8221; || relname || &#8216;\&#8217;,&#8217;<br />
from pg_class, pg_user<br />
where usesysid=relowner and<br />
(relkind =&#8217;r&#8217; or relkind=&#8217;s&#8217;) and (usename =&#8217;DB_NAME&#8217;) and<br />
(relkind !=&#8217;i&#8217; or relname !~&#8217;^xinx&#8217;)<br />
order by relname;</p>
<p>\o</p>
<p>Then add this around the list of tables<br />
<code><br />
INSERT INTO herdmap(herd,goat) SELECT 'HERD_NAME', id<br />
FROM goat WHERE db='DB_NAME' AND tablename IN (</code></p>
<p><strong>LIST OF TABLES GOES HERE&#8230;..</strong></p>
<p>);</p>
<p>** MAKE SURE YOU REMOVE ANY REFERENCES TO BUCARDO ** &#8211; again I do this by hand</p>
<p>then as user Bucardo</p>
<p><code>\i links.sql</code></p>
<p>To finalise the sync:</p>
<p><code>INSERT INTO sync(name,source,targetdb,synctype,checktime,disable_triggers,disable_rules)<br />
VALUES ('the_sync','HERD_NAME','other_server','swap','10 minutes','pg_class','pg_class');</code></p>
<p>First time only, or after a massive cock up:</p>
<p><code>INSERT INTO herd(name) VALUES ('HERD_NAME_full_copy');<br />
\i full_copy_links.sql<br />
INSERT INTO sync(name,source,targetdb,synctype,stayalive,kidsalive,ping,checktime,disable_triggers,disable_rules)<br />
VALUES ('fullsync','full_copy','other-server','fullcopy',false,false,false,'10 minutes','pg_class','pg_class');</code></p>
<p>Deactivate the_sync and make full_copy sync active to kick off only the full copy</p>
<p><code>update sync set status='inactive' where name ='the_sync';<br />
update sync set status='active' where name ='fullsync';<br />
./bucardo_ctl start "full_copy"<br />
./bucardo_ctl kick fullsync</code><br />
then<br />
<code>update sync set status='active' where name ='the_sync';<br />
update sync set status='inactive' where name ='fullsync';<br />
./bucardo_ctl stop "full_copy"<br />
./bucardo_ctl start "swap"</code></p>
<p><strong>To get some nicer defaults:</strong><br />
<code>update bucardo_config set value='email@email.com' where setting='default_email_to';<br />
update bucardo_config set value='email@email.com' where setting='default_email_from';<br />
update bucardo_config set value='http://stats_page.com/cgi-bin/' where setting='stats_script_url';</code></p>
<p>./bucardo_ctl status</p>
<p>will show basic info – much the same as:</p>
<p>http://stats_page.com/cgi-bin/bucardo-report</p>
<p>log file is: /var/log/bucardo.log</p>
<p>As root on main_server under /root/Bucardo/Bucardo-3.0.9</p>
<p><code>./bucardo_ctl stop "Stopping to add a new slave database - Greg"<br />
./bucardo_ctl start "Restarting after donut break - Greg"</code></p>
<p><strong>Housekeeping</strong><br />
This SQL is setup in a cronjob:<br />
<code>SELECT bucardo.bucardo_purge_delta('5 minutes'::interval);<br />
select bucardo_purge_q_table('5 minutes'::interval);</code></p>
<p>When you change anything in any database!</p>
<p><code>DELETE FROM sync;<br />
DELETE FROM goat;<br />
DELETE FROM db;<br />
DELETE FROM dbgroup;<br />
DELETE FROM dbmap;<br />
DELETE FROM herd;<br />
DELETE FROM herdmap;</code></p>
<p>INSERT INTO db(name, dbname, dbhost, dbuser)<br />
VALUES (&#8217;main-server&#8217;,'DB_NAME&#8217;,'nnn.nnn.nnn.nnn&#8217;,'DB_USER&#8217;);<br />
INSERT INTO db(name, dbname, dbhost, dbuser)<br />
VALUES (&#8217;other-server&#8217;,'DB_NAME&#8217;,&#8217; nnn.nnn.nnn.nnn&#8217;,'DB_USER&#8217;);</p>
<p>INSERT INTO dbgroup(name) VALUES (&#8217;remote_dbs&#8217;);<br />
INSERT INTO dbmap(db,dbgroup) VALUES (&#8217;dromore&#8217;,'remote_dbs&#8217;);</p>
<p>\i tables.sql</p>
<p>INSERT INTO herd(name) VALUES (&#8217;leisure&#8217;);</p>
<p>\i links.sql</p>
<p>To finalise the sync:</p>
<p><code>INSERT INTO sync(name,source,targetdb,synctype,checktime,disable_triggers,disable_rules)<br />
VALUES ('leisure_sync','leisure','dromore','swap','10 minutes','pg_class','pg_class');</code></p>
<p><strong>To re-install bucardo</strong></p>
<p>as psql:<br />
<code>dropdb bucardo</code></p>
<p>as DB_USER:<br />
<code>drop schema bucardo cascade</code></p>
<p>then just re-install from above</p>
<p><strong>The Inserts (Just for reference)</strong></p>
<p>INSERT INTO goat(db, tablename, pkey, pkeytype, standard_conflict) VALUES(&#8217;banbridge&#8217;, &#8216;accounts&#8217;, &#8216;id&#8217;, &#8216;int&#8217;, &#8217;source&#8217;);<br />
INSERT INTO goat(db, tablename, pkey, pkeytype, standard_conflict) VALUES(&#8217;banbridge&#8217;, &#8216;activities&#8217;, &#8216;id&#8217;, &#8216;int&#8217;, &#8217;source&#8217;);<br />
INSERT INTO goat(db, tablename, pkey, pkeytype, standard_conflict) VALUES(&#8217;banbridge&#8217;, &#8216;activity_product_group_map&#8217;, &#8216;id&#8217;, &#8216;int&#8217;, &#8217;source&#8217;);<br />
INSERT INTO goat(db, tablename, pkey, pkeytype, standard_conflict) VALUES(&#8217;banbridge&#8217;, &#8216;activity_product_map&#8217;, &#8216;id&#8217;, &#8216;int&#8217;, &#8217;source&#8217;);<br />
&#8230;<br />
INSERT INTO goat(db, tablename, pkey, pkeytype, standard_conflict) VALUES(&#8217;banbridge&#8217;, &#8216;vouchers&#8217;, &#8216;id&#8217;, &#8216;int&#8217;, &#8217;source&#8217;);<br />
INSERT INTO goat(db, tablename, pkey, pkeytype, standard_conflict) VALUES(&#8217;banbridge&#8217;, &#8216;work_addresses&#8217;, &#8216;id&#8217;, &#8216;int&#8217;, &#8217;source&#8217;);</p>
<p><strong>The Links (Just for reference)</strong></p>
<p>INSERT INTO herdmap(herd,goat) SELECT &#8216;leisure&#8217;, id<br />
FROM goat WHERE db=&#8217;banbridge&#8217; AND tablename IN (<br />
&#8216;accounts&#8217;,<br />
&#8216;activities&#8217;,<br />
&#8216;activity_product_group_map&#8217;,<br />
&#8216;activity_product_map&#8217;,<br />
&#8230;<br />
&#8216;vouchers&#8217;,<br />
&#8216;work_addresses&#8217;);</p>
<p><strong>Hot Restore</strong><br />
What I did: (found this somewhere but I can&#8217;t remember where&#8230;. probably the bucardo mailing list)<br />
On A site<br />
1. Stopped Bucardo (bucardo_ctl stop &#8216;testing hot restoration&#8217;)<br />
2. Inserted, deleted, updated records<br />
3. Created dump (pg_dump &#8211;data-only &#8211;disable-triggers mydb &gt; test.dump)<br />
4 Inserted, delete, updated records.<br />
5. Transferred the dump to the site B<br />
6. To imitate the database crash. Deleted (truncated) all tables on site B including  bucardo_delta, bucardo_track and bucardo_delta_targets.<br />
7. Restored dump (./bin/psql  ; \i test.dump)<br />
Note. Because I created the dump in the step 3 as a plain text I did not use pg_restore).<br />
8. Switched conflict_resolution value for all tables in the table goat from skip to target<br />
Note. I think this is an excessive precaution.<br />
9. Started Bucardo (bucardo_ctl start &#8216;testing hot restoration&#8217;)<br />
10. Was amused that Bucardo did not report any conflicts and restored all changes made before and after the dump creation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richardmartin.org/2009/01/bucardo-postgresql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.richardmartin.org/2009/01/bucardo-postgresql/</feedburner:origLink></item>
	</channel>
</rss>
