[open-ils-commits] r13911 - trunk/Open-ILS/examples (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Aug 21 01:14:29 EDT 2009
Author: miker
Date: 2009-08-21 01:14:25 -0400 (Fri, 21 Aug 2009)
New Revision: 13911
Added:
trunk/Open-ILS/examples/build-eg-replication.sh
Log:
beginnings of database replication helper scripts
Added: trunk/Open-ILS/examples/build-eg-replication.sh
===================================================================
--- trunk/Open-ILS/examples/build-eg-replication.sh (rev 0)
+++ trunk/Open-ILS/examples/build-eg-replication.sh 2009-08-21 05:14:25 UTC (rev 13911)
@@ -0,0 +1,105 @@
+#!/bin/sh
+#
+# Copyright (C) 2009 Equinox Software, Inc.
+# Author: Mike Rylander <miker at esilibrary.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+#
+# This script will help build the slonik scripts required to start
+# replicating an Evergreen database using Slony-I.
+#
+# See: slony-1.2.16/tools/configure-replication.txt
+# for more information on the process
+#
+# See: slony1-1.2.16/doc/adminguide/firstdb.html
+# for an example of how to get the schema copied
+#
+
+if [ "_$NUMNODES" == "_" ]; then
+ echo 'Please set the NUMNODES environment variable to the number of new nodes to be created in the new cluster'
+ exit
+fi
+
+if [ "_$CLUSTER" == "_" ]; then
+ echo 'Please set the CLUSTER environment variable to the new cluster name'
+ exit
+fi
+
+if [ "_$PGDATABASE" == "_" ]; then
+ echo 'Please set the PGDATABASE environment variable to the database name'
+ exit
+fi
+
+if [ "_$PGPORT" == "_" ]; then
+ echo 'Please set the PGPORT environment variable to the database port'
+ exit
+fi
+
+if [ "_$PGUSER" == "_" ]; then
+ echo 'Please set the PGPORT environment variable to the database superuser'
+ exit
+fi
+
+TABLES=$(psql -tc "
+ select array_to_string(array_accum(table_schema || '.' || table_name),' ')
+ from information_schema.tables
+ where table_schema in (
+ 'action', 'actor', 'asset', 'authority', 'auditor', 'biblio', 'config',
+ 'container', 'extend_reporter', 'metabib', 'money', 'offline', 'permission',
+ 'reporter', 'search', 'stats', 'vandely'
+ ) and table_type = 'BASE TABLE' order by 1;
+")
+
+SEQUENCES=$(psql -tc "select array_to_string(array_accum(schemaname || '.' || relname),' ') from pg_statio_user_sequences;")
+
+
+if [ "_$1" == "_" ]; then
+ echo 'Please specify at least one host!'
+ exit
+fi
+
+DB1=$PGDATABASE
+USER1=$PGUSER
+PORT1=$PGPORT
+HOST1=$1
+
+if [ "_$2" != "_" ]; then
+ DB2=$PGDATABASE
+ USER2=$PGUSER
+ PORT2=$PGPORT
+ HOST2=$2
+fi
+
+if [ "_$3" != "_" ]; then
+ DB3=$PGDATABASE
+ USER3=$PGUSER
+ PORT3=$PGPORT
+ HOST3=$3
+fi
+
+if [ "_$4" != "_" ]; then
+ DB4=$PGDATABASE
+ USER4=$PGUSER
+ PORT4=$PGPORT
+ HOST4=$4
+fi
+
+if [ "_$5" != "_" ]; then
+ DB5=$PGDATABASE
+ USER5=$PGUSER
+ PORT5=$PGPORT
+ HOST5=$5
+fi
+
+./configure-replication.sh
+
More information about the open-ils-commits
mailing list