Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Bruce - Postgres Replication
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<h2>Overview</h2> <p>This document should get you up and running with a replicated PostgreSQL database in just a few steps. We'll gloss over many details in the interest of getting you up and running as quickly as possible. To make things simple, this document will use the sample cluster configuration found in the "bruce/sample" directory of the distribution. The example uses a single PostgreSQL installation with 4 databases.</p> <ul> <li><code>bruce_config</code> - This database contains the cluster configuration metadata. This includes cluster names and identifiers, master database uri's and descriptive names, slave database uri's and descriptive names, and regular expression patterns to determine which tables are replicated.</li> <li><code>bruce_master</code> - The master database. All modifications to replicated tables are made to this database and subsequently replicated to each slave.</li> <li><code>bruce_slave_1</code> - A slave database. All modifications to the master database are replicated here.</li> <li><code>bruce_slave_2</code> - A slave database. All modifications to the master database are replicated here.</li> </ul> <p>The master and each slave have a <code>replication_test</code> schema and a <code>replication_test.replicate_this</code> table that we will replicate across the cluster.</p> <p><strong>Note:</strong> <em>This demonstration makes the assumption that all replicated clusters in the schema contain identical data.</em></p> <h2>Automated Test</h2> <p>The steps in this guide are loosely followed in test/src/com/netblue/bruce/SetupClusterFromExistingDbAcceptanceTest.java</p> <h2>Prerequisites</h2> <ul> <li>Download latest build: <a class="confluence-link unresolved" data-content-title="insert build link here" data-linked-resource-default-alias="insert build link here" href="#">insert build link here</a></li> <li><code>tar xvzf bruce-0.1a.tgz</code></li> <li>Change scripts to be executable:</li> <li><code>cd release/bin</code></li> <li><code>chmod 755 *.sh</code></li> <li>Ensure you have database set up properly:</li> <li>create db bruce_config</li> <li>create db bruce_master</li> <li>create db bruce_slave_1</li> <li>create db bruce_slave_2</li> <li>create user bruce with access to all databases and ability to create database objects (NB: need to think about security in real life applications)</li> <li>create schema replication_test in bruce_master, bruce_slave_1 and bruce_slave_2</li> <li>create table replication_test.replicate_this in bruce_master, bruce_slave_1 and bruce_slave_2</li> </ul> <h2>Configure the node topology database urls:</h2> <ul> <li><code>cd $BRUCE/sample</code></li> <li><code>vi config.xml</code> (change db urls to point to your databases for each node)</li> </ul> <h3>Setup the node topology</h3> <ul> <li><code>cd $BRUCE/bin</code></li> <li><code>./admin.sh -data ../sample/config.xml -initnodeschema -initsnapshots MASTER -loadschema -operation CLEAN_INSERT -url jdbc:postgresql://localhost:5432/bruce_config?user=bruce -pass bruce</code></li> </ul> <h3>Command line notes:</h3> <p>-data ../sample/config.xml tells us what data file to load. the sample file contains 1 master and 2 slaves with replication patterns to recognize the replication_test.* tables. </p> <p>-initnodeschema tells us to install the replication schema on each node, along with the triggers for each replicated table. If the schema is already installed, then only the replication triggers are installed for each replicated table. For master nodes, if there is no data in the snapshotlog table (as in this case) a snapshot of the db is taken.</p> <p>-initsnapshots MASTER tells us to set the slave snapshot status to the last snapshot in the master database. Since the -initnodeschema option initializes this for us, we'll use that. </p> <p>-loadschema tells us to install the replication node topology schema on the configuration database. This is only really useful the first time you run the admin tool for a given configuration database.</p> <p>-operation CLEAN_INSERT tells us to drop everything from the node topology configuration database before inserting these new nodes</p> <p>-url is the URL for the configuration database</p> <p>-pass is the password for the configuration database</p> <h3>Start up replication for the new cluster</h3> <ul> <li>cd $BRUCE/bin</li> <li>./startup.sh ClusterOne</li> </ul> <h3>Insert rows in master, confirm slave is updated</h3> <ul> <li>psql bruce_master</li> <li>insert into replication_test.replicate_this (name, value) values ('One', 1);</li> <li>\c bruce_slave_1</li> <li>select * from replication_test.replicate_this</li> <li>\c bruce_slave_2</li> <li>select * from replication_test.replicate_this</li> </ul>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced