Вы находитесь на странице: 1из 8

Cluster ReadOnly1

******************
Participating Machines
----------------------
1. MDB1 - 192.168.0.15
2. SDB1 - 192.168.0.20
3. SDB2 - 192.168.0.22
4. SDB3 - 192.168.0.24
5. SDB4 - 192.168.0.26
6. SDB36 - 100.112.0.24
7. SDB38 - 100.112.0.28
8. SDB310 - 100.112.0.32
9. SDB41 - 100.130.0.20
10. SDB42 - 100.130.0.22
Execute on MDB1
---------------
/opt/PostgresPlus/8.3AS/dbserver/bin/slonik <<_EOF_
cluster name = ReadOnly1;
node 1 admin conninfo = 'dbname=prod_db host=192.168.0.15 port=5432 user=postgre
s';
node 2 admin conninfo = 'dbname=prod_db host=192.168.0.20 port=5432 user=postgre
s';
node 3 admin conninfo = 'dbname=prod_db host=192.168.0.22 port=5432 user=postgre
s';
node 4 admin conninfo = 'dbname=prod_db host=192.168.0.24 port=5432 user=postgre
s';
node 5 admin conninfo = 'dbname=prod_db host=192.168.0.26 port=5432 user=postgre
s';
node 6 admin conninfo = 'dbname=prod_db host=100.112.0.24 port=5432 user=postgre
s';
node 7 admin conninfo = 'dbname=prod_db host=100.112.0.28 port=5432 user=postgre
s';
node 8 admin conninfo = 'dbname=prod_db host=100.112.0.32 port=5432 user=postgre
s';
node 9 admin conninfo = 'dbname=prod_db host=100.130.0.20 port=5432 user=postgre
s';
node 10 admin conninfo = 'dbname=prod_db host=100.130.0.22 port=5432 user=postgr
es';

## create cluster
init cluster ( id=1, comment = 'Master Node');
## create set
create set (id=1, origin=1, comment='base table');
set add table (set id=1, origin=1, id=10, fully qualified name = 'public.custome
r', comment='customer table');
set add table (set id=1, origin=1, id=12, fully qualified name = 'public.employe
e', comment='employee table');
## store node
store node (id=2, comment = 'SDB1');
store node (id=3, comment = 'SDB2');
store node (id=4, comment = 'SDB3');
store node (id=5, comment = 'SDB4');
store node (id=6, comment = 'SDB36');
store node (id=7, comment = 'SDB38');
store node (id=8, comment = 'SDB310');
store node (id=9, comment = 'SDB41');
store node (id=10, comment = 'SDB42');
## store database path
# MDB1 - SDB1 and vice versa
store path (server=1, client=2, conninfo='dbname=prod_db host=192.168.0.15 port=
5432 user=postgres');
store path (server=2, client=1, conninfo='dbname=prod_db host=192.168.0.20 port=
5432 user=postgres');
# MDB1 - SDB2 and vice versa
store path (server=1, client=3, conninfo='dbname=prod_db host=192.168.0.15 port=
5432 user=postgres');
store path (server=3, client=1, conninfo='dbname=prod_db host=192.168.0.22 port=
5432 user=postgres');
# MDB1 - SDB3 and vice versa
store path (server=1, client=4, conninfo='dbname=prod_db host=192.168.0.15 port=
5432 user=postgres');
store path (server=4, client=1, conninfo='dbname=prod_db host=192.168.0.24 port=
5432 user=postgres');
# MDB1 - SDB4 and vice versa
store path (server=1, client=5, conninfo='dbname=prod_db host=192.168.0.15 port=
5432 user=postgres');
store path (server=5, client=1, conninfo='dbname=prod_db host=192.168.0.26 port=
5432 user=postgres');
# SDB3 - SDB36 and vice versa
store path (server=4, client=6, conninfo='dbname=prod_db host=192.168.0.24 port=
5432 user=postgres');
store path (server=6, client=4, conninfo='dbname=prod_db host=100.112.0.24 port=
5432 user=postgres');
# SDB4 - SDB41 and vice versa
store path (server=5, client=9, conninfo='dbname=prod_db host=192.168.0.26 port=
5432 user=postgres');
store path (server=9, client=5, conninfo='dbname=prod_db host=100.130.0.20 port=
5432 user=postgres');
# SDB36 - SDB38 and vice versa
store path (server=6, client=7, conninfo='dbname=prod_db host=100.112.0.24 port=
5432 user=postgres');
store path (server=7, client=6, conninfo='dbname=prod_db host=100.112.0.28 port=
5432 user=postgres');
# SDB36 - SDB310 and vice versa
store path (server=6, client=8, conninfo='dbname=prod_db host=100.112.0.24 port=
5432 user=postgres');
store path (server=8, client=6, conninfo='dbname=prod_db host=100.112.0.32 port=
5432 user=postgres');
# SDB41 - SDB42 and vice versa
store path (server=9, client=10, conninfo='dbname=prod_db host=100.130.0.20 port
=5432 user=postgres');
store path (server=10, client=9, conninfo='dbname=prod_db host=100.130.0.22 port
=5432 user=postgres');
_EOF_
Execute the following command on all the above 10 hosts
--------------------------------------------------------
nohup /opt/PostgresPlus/8.3AS/dbserver/bin/edb-replication ReadOnly1 'dbname=pro
d_db port=5432 user=postgres' > /var/log/slon_readonly1.log 2>&1 &
Execute on MDB1
----------------
/opt/PostgresPlus/8.3AS/dbserver/bin/slonik <<_EOF_
cluster name = ReadOnly1;
node 1 admin conninfo = 'dbname=prod_db host=192.168.0.15 port=5432 user=postgre
s';
node 2 admin conninfo = 'dbname=prod_db host=192.168.0.20 port=5432 user=postgre
s';
node 3 admin conninfo = 'dbname=prod_db host=192.168.0.22 port=5432 user=postgre
s';
node 4 admin conninfo = 'dbname=prod_db host=192.168.0.24 port=5432 user=postgre
s';
node 5 admin conninfo = 'dbname=prod_db host=192.168.0.26 port=5432 user=postgre
s';
node 6 admin conninfo = 'dbname=prod_db host=100.112.0.24 port=5432 user=postgre
s';
node 7 admin conninfo = 'dbname=prod_db host=100.112.0.28 port=5432 user=postgre
s';
node 8 admin conninfo = 'dbname=prod_db host=100.112.0.32 port=5432 user=postgre
s';
node 9 admin conninfo = 'dbname=prod_db host=100.130.0.20 port=5432 user=postgre
s';
node 10 admin conninfo = 'dbname=prod_db host=100.130.0.22 port=5432 user=postgr
es';
# subscribe MDB1 - SDB1
subscribe set (id=1, provider=1, receiver=2, forward=no);
# subscribe MDB1 - SDB2
subscribe set (id=1, provider=1, receiver=3, forward=no);
# subscribe MDB1 - SDB3
subscribe set (id=1, provider=1, receiver=4, forward=yes);
# subscribe MDB1 - SDB4
subscribe set (id=1, provider=1, receiver=5, forward=yes);
# subscribe SDB3 - SDB36
subscribe set (id=1, provider=4, receiver=6, forward=yes);
# subscribe SDB4 - SDB41
subscribe set (id=1, provider=5, receiver=9, forward=yes);
# subscribe SDB36 - SDB38
subscribe set (id=1, provider=6, receiver=7, forward=yes);
# subscribe SDB36 - SDB310
subscribe set (id=1, provider=6, receiver=8, forward=yes);
# subscribe SDB41 - SDB42
subscribe set (id=1, provider=9, receiver=10, forward=yes);
_EOF_

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Cluster ReadOnly2
******************
Participating Machines
----------------------
1. SDB1 - 192.168.0.20
2. SDB21 - 100.155.0.20
Stunnel setup exists between these two machines and it works as follows:
on SDB1 running edb-psql -h 127.0.0.1 -p 3108 -U postgres prod_db will connect t
o SDB21 machine on 5432 port to prod_db database
on SDB21 running edb-psql -h 127.0.0.1 -p 3107 -U postgres prod_db will connect
to SDB1 machine on 5432 port to prod_db database
Execute on SDB1
----------------
/opt/PostgresPlus/8.3AS/dbserver/bin/slonik <<_EOF_
cluster name = ReadOnly2;
node 1 admin conninfo = 'dbname=prod_db host=192.168.0.20 port=5432 user=postgre
s';
node 2 admin conninfo = 'dbname=prod_db host=127.0.0.1 port=3108 user=postgres';
## create cluster
init cluster ( id=1, comment = 'Master Node');
## create set
create set (id=1, origin=1, comment='base table');
set add table (set id=1, origin=1, id=10, fully qualified name = 'public.custome
r', comment='customer table');
set add table (set id=1, origin=1, id=12, fully qualified name = 'public.employe
e', comment='employee table');
## store node
store node (id=2, comment = 'SDB21');
## store database path
store path (server=1, client=2, conninfo='dbname=prod_db host=127.0.0.1 port=310
7 user=postgres');
store path (server=2, client=1, conninfo='dbname=prod_db host=127.0.0.1 port=310
8 user=postgres');
_EOF_

nohup /opt/PostgresPlus/8.3AS/dbserver/bin/edb-replication ReadOnly2 'dbname=pro


d_db port=5432 user=postgres' > /var/log/slon_readonly2.log 2>&1 &
Execute on SDB21
----------------
nohup /opt/PostgresPlus/8.3AS/dbserver/bin/edb-replication ReadOnly2 'dbname=pro
d_db port=5432 user=postgres' > /var/log/slon_readonly2.log 2>&1 &
Execute on SDB1
----------------
/opt/PostgresPlus/8.3AS/dbserver/bin/slonik <<_EOF_
cluster name = ReadOnly2;
node 1 admin conninfo = 'dbname=prod_db host=192.168.0.20 port=5432 user=postgre
s';
node 2 admin conninfo = 'dbname=prod_db host=127.0.0.1 port=3108 user=postgres';
subscribe set (id=1, provider=1, receiver=2, forward=no);
_EOF_
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Cluster ReadOnly3
******************
Participating Machines
----------------------
1. SDB2 - 192.168.0.22
2. SDB22 - 100.155.0.22
Stunnel setup exists between these two machines and it works as follows:
on SDB2 running edb-psql -h 127.0.0.1 -p 3108 -U postgres prod_db will connect t
o SDB22 machine on 5432 port to prod_db database
on SDB22 running edb-psql -h 127.0.0.1 -p 3107 -U postgres prod_db will connect
to SDB2 machine on 5432 port to prod_db database

Execute on SDB2
----------------
/opt/PostgresPlus/8.3AS/dbserver/bin/slonik <<_EOF_
cluster name = ReadOnly3;
node 1 admin conninfo = 'dbname=prod_db host=192.168.0.22 port=5432 user=postgre
s';
node 2 admin conninfo = 'dbname=prod_db host=127.0.0.1 port=3108 user=postgres';
## create cluster
init cluster ( id=1, comment = 'Master Node');
## create set
create set (id=1, origin=1, comment='base table');
set add table (set id=1, origin=1, id=10, fully qualified name = 'public.custome
r', comment='customer table');
set add table (set id=1, origin=1, id=12, fully qualified name = 'public.employe
e', comment='employee table');
## store node
store node (id=2, comment = 'SDB22');
## store database path
store path (server=1, client=2, conninfo='dbname=prod_db host=127.0.0.1 port=310
7 user=postgres');
store path (server=2, client=1, conninfo='dbname=prod_db host=127.0.0.1 port=310
8 user=postgres');
_EOF_

nohup /opt/PostgresPlus/8.3AS/dbserver/bin/edb-replication ReadOnly3 'dbname=pro


d_db port=5432 user=postgres' > /var/log/slon_readonly3.log 2>&1 &
Execute on SDB22
----------------
nohup /opt/PostgresPlus/8.3AS/dbserver/bin/edb-replication ReadOnly3 'dbname=pro
d_db port=5432 user=postgres' > /var/log/slon_readonly3.log 2>&1 &
Execute on SDB2
----------------
/opt/PostgresPlus/8.3AS/dbserver/bin/slonik <<_EOF_
cluster name = ReadOnly3;
node 1 admin conninfo = 'dbname=prod_db host=192.168.0.22 port=5432 user=postgre
s';
node 2 admin conninfo = 'dbname=prod_db host=127.0.0.1 port=3108 user=postgres';
subscribe set (id=1, provider=1, receiver=2, forward=no);
_EOF_
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Cluster ReadOnly4
******************
Participating Machines
----------------------
1. SDB21 - 100.155.0.20
2. SDB23 - 100.155.0.24
Execute on SDB21
----------------
/opt/PostgresPlus/8.3AS/dbserver/bin/slonik <<_EOF_
cluster name = ReadOnly4;
node 1 admin conninfo = 'dbname=prod_db host=100.155.0.20 port=5432 user=postgre
s';
node 2 admin conninfo = 'dbname=prod_db host=100.155.0.24 port=5432 user=postgre
s';
## create cluster
init cluster ( id=1, comment = 'Master Node');
## create set
create set (id=1, origin=1, comment='base table');
set add table (set id=1, origin=1, id=10, fully qualified name = 'public.custome
r', comment='customer table');
set add table (set id=1, origin=1, id=12, fully qualified name = 'public.employe
e', comment='employee table');
## store node
store node (id=2, comment = 'SDB23');
## store database path
store path (server=1, client=2, conninfo='dbname=prod_db host=100.155.0.20 port=
5432 user=postgres');
store path (server=2, client=1, conninfo='dbname=prod_db host=100.155.0.24 port=
5432 user=postgres');
_EOF_

nohup /opt/PostgresPlus/8.3AS/dbserver/bin/edb-replication ReadOnly4 'dbname=pro


d_db port=5432 user=postgres' > /var/log/slon_readonly4.log 2>&1 &
Execute on SDB23
----------------
nohup /opt/PostgresPlus/8.3AS/dbserver/bin/edb-replication ReadOnly4 'dbname=pro
d_db port=5432 user=postgres' > /var/log/slon_readonly4.log 2>&1 &
Execute on SDB21
----------------
/opt/PostgresPlus/8.3AS/dbserver/bin/slonik <<_EOF_
cluster name = ReadOnly4;
node 1 admin conninfo = 'dbname=prod_db host=100.155.0.20 port=5432 user=postgre
s';
node 2 admin conninfo = 'dbname=prod_db host=100.155.0.24 port=5432 user=postgre
s';
subscribe set (id=1, provider=1, receiver=2, forward=yes);
_EOF_
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Cluster ReadOnly5
******************
Participating Machines
----------------------
1. SDB22 - 100.155.0.22
2. SDB24 - 100.155.0.26
Execute on SDB22
----------------
/opt/PostgresPlus/8.3AS/dbserver/bin/slonik <<_EOF_
cluster name = ReadOnly5;
node 1 admin conninfo = 'dbname=prod_db host=100.155.0.22 port=5432 user=postgre
s';
node 2 admin conninfo = 'dbname=prod_db host=100.155.0.26 port=5432 user=postgre
s';
## create cluster
init cluster ( id=1, comment = 'Master Node');
## create set
create set (id=1, origin=1, comment='base table');
set add table (set id=1, origin=1, id=10, fully qualified name = 'public.custome
r', comment='customer table');
set add table (set id=1, origin=1, id=12, fully qualified name = 'public.employe
e', comment='employee table');
## store node
store node (id=2, comment = 'SDB24');
## store database path
store path (server=1, client=2, conninfo='dbname=prod_db host=100.155.0.22 port=
5432 user=postgres');
store path (server=2, client=1, conninfo='dbname=prod_db host=100.155.0.26 port=
5432 user=postgres');
_EOF_

nohup /opt/PostgresPlus/8.3AS/dbserver/bin/edb-replication ReadOnly5 'dbname=pro


d_db port=5432 user=postgres' > /var/log/slon_readonly5.log 2>&1 &
Execute on SDB24
----------------
nohup /opt/PostgresPlus/8.3AS/dbserver/bin/edb-replication ReadOnly5 'dbname=pro
d_db port=5432 user=postgres' > /var/log/slon_readonly5.log 2>&1 &
Execute on SDB22
----------------
/opt/PostgresPlus/8.3AS/dbserver/bin/slonik <<_EOF_
cluster name = ReadOnly5;
node 1 admin conninfo = 'dbname=prod_db host=100.155.0.22 port=5432 user=postgre
s';
node 2 admin conninfo = 'dbname=prod_db host=100.155.0.26 port=5432 user=postgre
s';
subscribe set (id=1, provider=1, receiver=2, forward=yes);
_EOF_

Вам также может понравиться