설문조사
PostgreSQL/PPAS 관련 듣고 싶은 교육은


총 게시물 187건, 최근 0 건
   

master slave 관련해서 딜레이가 궁금합니다

글쓴이 : 소심 날짜 : 2018-12-18 (화) 17:59 조회 : 4082
master1에 slave1,2,3를 연결하고 프로시저로 부하를 주는 상태에서 마스터와 슬레이브간의 딜레이를 슬레이브 측에서 구해볼려고 하는데 select now()-pg_last_xact_replay_timestamp()로 딜레이를 확인하는 방법이 맞는건가요?

PostgresDBA 2018-12-19 (수) 10:18
댓글주소
     
     
소심 2018-12-19 (수) 15:24
답변 감사합니다.
해결할수 있을것 같네요.
댓글주소
Joker 2019-01-03 (목) 18:48
replication  구조에서  Slave DB에서  저는 아래 Query 사용합니다

select
      case when pg_last_xlog_receive_location() = pg_last_xlog_replay_location() then 0
      else extract ( epoch from now() - pg_last_xact_replay_timestamp()) end            as log_delay ;

추가로  pg_stat_wal_receiver ;  경우 postgrsql 9.6 부터 나온걸로 알고있습니다.
-  master 에서 slave DB 볼때는 select * from pg_stat_replication
- slave DB 에서 Master 확인할때는 위에서 말씀하신 걸 사용하시면 됩니다.
댓글주소
   

postgresdba.com