BDR 00 01 Postgre SQL 02 DR 03
BDR ?
00 순서 01. Postgre. SQL 첫사랑 02. 이중화, DR 사고는 영화에서나? 03. Postgre. SQL 10년만의 재회 04. Streaming Replication 05. 고객사 요구사항, BMT, POC 06. Streaming Replication Customizing 07. 실패 08. Bucard 09. BDR 이란? 10. BDR 특징 11. BDR 설치 12. 주의 해야 할점 13. 뭣이 중헌디? 14. 좋은 놈, 공부할 놈, 아쉬운 놈 15. 최근 소식 3
01 Postgre. SQL 첫사랑 2000년 아이오 리눅스 대학교 컴퓨터 공학 Oracle Postgre. SQL 알짜 레드햇 Mandrake 4
04 Streaming Replication 자체 개발한 이중화 Daemon 사용 § § 서버 1대에서 C엔진, WAS, DB, 배치등을 관리 DB = Streaming Replication + Repmgr 사용자 사용자 Master Java 자 체 개 발 Postgres C OS : Centos D A E M O N Fail. Over Slave Java Postgres C OS : Centos 8
05 고객사 요구사항, BMT, POC Slave Master Slave 2 (DR Master) 100. 1. 1. 2 100. 1. 1. 1 Target (DR) 100. 1. 1. 3 Target § Master 서버 pg_hba. conf host replication postgres 100. 1. 1. 1/32 trust host replication postgres 100. 1. 1. 2/32 trust § Slave 서버 pg_hba. conf host replication postgres 100. 1. 1. 3/32 trust 추가 § Slave 2 > pg_basebackup -h 100. 1. 1. 2 -p 5432 -U postgres -D /var/lib/pgsql/9. 4. 4/data --xlog --checkpoint=fast –progress § Slave 2 > recovery. conf primary_conninfo = 'host=100. 1. 1. 2 port=5432' 10
06 Streaming Replication Customizing Master 이 중 화 Fail. Over D A E M O N Postgres Master용 설정파일 Slave용 설정파일 설정 파일 복사 Slave 설정 파일 복사 Postgres Master용 설정파일 Slave용 설정파일 § Master, Slave 서버에 Postgresql Master용, Slave용 2가지 설정 파일을 보관 postgresql. conf_master, pg_hba. conf_master postgresql. conf_slave, pg_hba. conf_slave § Fail. Over 시 Daemon은 Master, Slave 용 파일을 복사해서 재가동 Master 일 경우 Slave 용 설정 파일을 복사 Slave 일 경우 Master 용 설정 파일을 복사 11
09 BDR 이란? Postgre. SQL Replication History § Postgre. SQL 9. 0(2010) Streaming Repliction(physical) § Postgre. SQL 9. 4(2014) Logical Decoding(changeset extraction) § physical 한 row를 테이블에 저장 한다면 insert 외에 모든 index entries를 기록 WAL의 insert 관련 byte/block 레벨의 모든 변화를 전송 § logical WAL를 logical decoding(데이터 베이스 테이블의 영구 변화를 데이터 베이스 내부 상태에 대한 상세 지식없이 해석 가능하게, 알기 쉬운 포맷으로 추출하는 과정) 을 이용해서 storage level의 변화를 stream of tuples or SQL statements 로 전송 16
09 BDR 이란? Logical Streaming Replication Master User WAL Master WAL Sender Apply Database 17 User WAL
11 설치 bdr 환경설정 http: //bdr-project. org/docs/stable/installation-source. html 참조 공통 u postgresql-bdr, bdr-plugin을 다운로드 u postgresql. conf 파일 shared_preload_libraries = ‘bdr’ u pg_ctl 시작후 아래 구문 실행 CREATE EXTENSION btree_gist CREATE EXTENSION bdr 복제 그룹 생성 Master 1 SELECT bdr_group_create( local_node_name : = ‘test 1', node_external_dsn : = 'host=192. 100. 1. 1 port=5432 dbname=gt 1000‘ ); 복제 그룹에 참여 Master 2 SELECT bdr_group_join( local_node_name : = ‘test 2', node_external_dsn : = 'host=192. 100. 1. 2 port=5432 dbname=gt 1000', join_using_dsn : = 'host=192. 100. 1. 1 port=5432 dbname=gt 1000‘ ); 20
12 주의 해야 할 점 Master 1 Master 2 Data. Base 시퀀스 1, 2, 3, 4. . Data. Base 시퀀스 100001, 100002, 100003. . 1 홍길동 OTP 인증 2016. 10. 15 15: 33: 30. 11111 100001 허준 OTP 검증 2016. 10. 15 15: 33: 31. 11111 100002 gt 1000 OTP 생성 2016. 10. 15 15: 33: 32. 11111 2 장금이 OTP 생성 2016. 10. 15 15: 33. 11111 ALTER SEQUENCE seq_user_group START WITH 30; 사용불가 ALTER TABLE user ADD COLUMN otp_code varchar(8) DEFAULT ‘ 0000' NOT NULL; 22
15 최근소식 Postgre. SQL 9. 6 에는 Global Sequences 문제를 다른 방식으로 접근할 예정 http: //blog. 2 ndquadrant. com/bdr-is-coming-to -postgresql-9 -6/ The years of effort we at 2 nd. Quadrant have put into getting the series of patches from BDR into Postgre. SQL core have paid off. As of Postgre. SQL 9. 6, the only major patch that Postgres-BDR on 9. 4 has that Postgre. SQL core doesn’t, is the sequence access method patch that powers global sequences. This means that Postgres-BDR on 9. 6 will not support global sequences, at least not the same way they exist in 9. 4. The 9. 6 version will incorporate a different approach to handling sequences on distributed systems, and in the process address some issues that arose when using global sequences in production. 28
- Slides: 28