3 # Copyright (C) 2009 Equinox Software, Inc.
4 # Author: Mike Rylander <miker@esilibrary.com>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
18 # This script will help build the slonik scripts required to start
19 # replicating an Evergreen database using Slony-I.
21 # See: slony-1.2.16/tools/configure-replication.txt
22 # for more information on the process
24 # See: slony1-1.2.16/doc/adminguide/firstdb.html
25 # for an example of how to get the schema copied
28 if [ "_$NUMNODES" == "_" ]; then
29 echo 'Please set the NUMNODES environment variable to the number of new nodes to be created in the new cluster'
33 if [ "_$CLUSTER" == "_" ]; then
34 echo 'Please set the CLUSTER environment variable to the new cluster name'
38 if [ "_$PGDATABASE" == "_" ]; then
39 echo 'Please set the PGDATABASE environment variable to the database name'
43 if [ "_$PGPORT" == "_" ]; then
44 echo 'Please set the PGPORT environment variable to the database port'
48 if [ "_$PGUSER" == "_" ]; then
49 echo 'Please set the PGPORT environment variable to the database superuser'
53 if [ "_$TABLES" == "_" ]; then
55 select array_to_string(array_accum(table_schema || '.' || table_name),' ')
56 from information_schema.tables
57 where table_schema in (
58 'acq', 'action', 'action_trigger', 'actor', 'asset', 'asset_hist', 'auditor',
59 'authority', 'biblio', 'booking', 'circ_stats', 'config', 'container',
60 'extend_reporter', 'metabib', 'money', 'offline', 'permission', 'query',
61 'reporter', 'search', 'serial', 'staging', 'stats', 'vandelay'
62 ) and table_type = 'BASE TABLE' order by 1;
64 TABLES="$TABLES pg_ts_cfg pg_ts_cfgmap"
67 if [ "_$SEQUENCES" == "_" ]; then
68 SEQUENCES=$(psql -tc "select array_to_string(array_accum(schemaname || '.' || relname),' ') from pg_statio_user_sequences;")
72 if [ "_$1" == "_" ]; then
73 echo 'Please specify at least one host!'
82 if [ "_$2" != "_" ]; then
89 if [ "_$3" != "_" ]; then
96 if [ "_$4" != "_" ]; then
103 if [ "_$5" != "_" ]; then
110 ./configure-replication.sh