IT Japan

master측의 설정 본문

IT/PostgreSQL

master측의 설정

swhwang 2014. 10. 26. 22:22
반응형
master의 설정
standby_mode = 'off'로 설정
#/usr/local/postgresql9/bin/psql -p 5432 -U interdev

postgres=# select pg_start_backup('hwang');
pg_start_backup
-----------------
0/2000020
(1 row)

postgres=# \q

[root@tmc_db01 hwangtemp]# cd /data13

[root@tmc_db01 data13]# ls -la

[root@tmc_db01 data13]# tar cvfz data.tar.gz data

[root@tmc_db01 data13]# ls -la
 data.tar.gz

[root@tmc_db01 data13]# scp data.tar.gz interdev@172.29.1.113:/tmp
interdev@172.29.1.113's password:
data.tar.gz

[root@tmc_db01 data13]# /usr/local/postgresql9/bin/psql -p 5432 -U postgres -d
psql (9.0.2)
Type "help" for help.


postgres=# select pg_stop_backup();
NOTICE:  pg_stop_backup cleanup done, waiting for required WAL segments to be



WARNING:  pg_stop_backup still waiting for all required WAL segments to be arc
HINT:  Check that your archive_command is executing properly.  pg_stop_backup
ERROR:  canceling statement due to statement timeout
postgres=#
postgres=#
postgres=#
postgres=# \q


slave의 설정

[root@tmc_db02 tmp]# mv data.tar.gz /data14/
[root@tmc_db02 tmp]# cd /data14
[root@tmc_db02 data14]# ls -la
total 3388
drwxr-xr-x  2 root     root          24 Apr  6 06:02 .
drwxr-xr-x 25 root     root        4096 Apr  3 05:38 ..
-rw-r--r--  1 interdev interdev 3457269 Apr  6 06:00 data.tar.gz
[root@tmc_db02 data14]# tar xvzf data.tar.gz




[root@tmc_db02 data]# vi postgresql.conf

archive_command의 수정
wal_level = hot_standby
standby_mode = 'on'




touch recovery.conf
ls -la
chown -R postgres.postgres recovery.conf
ls -la
vi recovery.conf
#restore_command = '/bin/cp /var/atgames/db/pg_standby/archive41 %f %p 2>>./pg_log/standby.log'          # e.g. 'cp /mnt/server/archivedir/%f %p'





반응형
Comments