티스토리 뷰

slony専用クラスタの作成
/var/atgames/slony/init_cluster_replace_setup.sh
-----(atgames01の場合)-----
#!/bin/bash
HOST1=172.19.1.31
PGDATABASE=atgames01
PGUSER=postgres
PGPORT=5432
PSQL=/usr/local/postgresql/bin/psql
SLONIK=/usr/local/slony/bin/slonik

$SLONIK <<_EOF_
cluster name = atgames01cluster;
node 1 admin conninfo='host=$HOST1 dbname=$PGDATABASE user=$PGUSER port=$PGPORT';

init cluster ( id=1, comment = 'Master Node');
_EOF_
$SLONIK <<_EOF_
-----
実行するのにあたって、slonyのプログラムが必要かと思います。

SLONIK=/usr/local/slony/bin/slonik

以下に展開して保存しました。
$ ls -la /usr/local/ | grep slony
lrwxrwxrwx  1 root     root       15  1月 28 17:02 slony -> slony1-1.2.14rc
drwxr-xr-x  4 root     root     4096  1月 28 17:00 slony1-1.2.14rc

リストアの実行

slonyのdeny制御解除
psqlで接続後、以下の更新を実行
-----(atgames01の場合)-----
BEGIN;
drop index _atgames01cluster.sl_table_tab_reloid_key;
update _atgames01cluster.sl_table set
  tab_reloid = subq.relid
  from
    (select
      relname,
      relid
    from
      pg_stat_all_tables
    ) subq
where
  _atgames01cluster.sl_table.tab_relname = subq.relname
;
select relid,tab_reloid,relname from pg_stat_all_tables inner join
_atgames01cluster.sl_table on relname=tab_relname order by relname;
COMMIT;


slony 스키마의 삭제
/var/atgames/slony/uninstall_cluster_replace_setup.sh
-----(atgames01의 경우)-----
#!/bin/sh

#master hostname
HOST1=172.19.1.31
#PostgreSQL USENAME
PGUSER=postgres
#PostgreSQL PORT
PGPORT=5432
#PostgreSQL DATABASE NAME
PGDATABASE=atgames01
CLUSTER1=atgames01cluster

SLONIK=/usr/local/slony/bin/slonik

$SLONIK <<_EOF_
cluster name = $CLUSTER1;
node 1 admin conninfo='host=$HOST1 dbname=$PGDATABASE user=$PGUSER port=$PGPORT';
uninstall node (id = 1);
_EOF_
-----

'DB > PostgreSQL' 카테고리의 다른 글

새로운 DB를 구축  (0) 2016.05.04
wget http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CD  (0) 2016.05.04
PostgreSQL 백업 쉘  (0) 2016.05.04
postgresql 停止手順  (0) 2016.05.04
tmc_db01 backup 순서  (0) 2016.05.04
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2026/03   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
글 보관함