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 'action', 'actor', 'asset', 'authority', 'auditor', 'biblio', 'config',
59 'container', 'extend_reporter', 'metabib', 'money', 'offline', 'permission',
60 'reporter', 'search', 'stats', 'vandely'
61 ) and table_type = 'BASE TABLE' order by 1;
63 TABLES="$TABLES pg_ts_cfg pg_ts_cfgmap"
66 if [ "_$SEQUENCES" == "_" ]; then
67 SEQUENCES=$(psql -tc "select array_to_string(array_accum(schemaname || '.' || relname),' ') from pg_statio_user_sequences;")
71 if [ "_$1" == "_" ]; then
72 echo 'Please specify at least one host!'
81 if [ "_$2" != "_" ]; then
88 if [ "_$3" != "_" ]; then
95 if [ "_$4" != "_" ]; then
102 if [ "_$5" != "_" ]; then
109 ./configure-replication.sh