About
home
Tmax OpenSQL
home
💻

45. bucardo

작성자
KMS

bucardo 개요

bucardo 란?

Its heart a Perl daemon that listens for NOTIFY requests and acts on them, by connecting to remote databases and copying data back and forth - bucardo 공식 문서 -
bucardo 공식 홈페이지 : https://bucardo.org/Bucardo/
Bucardo는 복제 및 동기화 솔루션 이며, 다중 마스터 복제, 다중 노드 복제, 양방향 복제 등 다양한 복제 방법 지원하며, 안정성과 유연성을 제공합니다.
Bucardo 주요 개념과 기능은 아래와 같습니다.
주요 개념과 기능
기능
설명
DB Group
데이터 베이스 서버 그룹을 나타낸다.
Rel Group
복제할 테이블의 그룹을 나타낸다.
Sync
데이터 동기화 작업을 나타낸다. DB Group 과 Rel Group 간의 관계를 설정하여 데이터를 복제를 관리
Bucardo Daemon
데이터 변경을 모니터링하고 동기화 작업을 실행
설정 파라미터 - Bucardo show all
파라미터

bucardo 설치

Bucardo 설치 파일 다운로드
wget -q https://bucardo.org/downloads/Bucardo-5.6.0.tar.gz
Shell
복사
다운로드 받은 파일 압축 해제
tar xf Bucardo-5.6.0.tar.gz cd Bucardo-*/
Shell
복사
Bucardo 설치 전 필요한 라이브러리 설치
yum install -y perl-CPAN perl-DBI perl-DBD-Pg yum install -y perl-Sys-Syslog #DBIx-Safe 설치 rpm -ivh https://download-ib01.fedoraproject.org/pub/epel/7/aarch64/Packages/p/perl-DBIx-Safe-1.2.5-25.el7.noarch.rpm yum install postgresql14-plperl -y
Shell
복사
bucardo 디렉토리 생성
-- root mkdir -p /var/run/bucardo /var/log/bucardo touch /var/log/bucardo/log.bucardo chown -R opensql:tmax /var/run/bucardo chown -R opensql:tmax /var/log/bucardo
Shell
복사
OpenSQL 설정
-- opensql psql -c "CREATE USER bucardo SUPERUSER PASSWORD 'bucardo';" psql -c "CREATE DATABASE bucardo;" chown -R opensql:tmax /var/run/bucardo chown -R opensql:tmax /var/log/bucardo
Shell
복사
Bucardo Install
[opensql@localhost:~]$ bucardo -h 192.168.245.180 install This will install the bucardo database into an existing Postgres cluster. Postgres must have been compiled with Perl support, and you must connect as a superuser Current connection settings: 1. Host: 192.168.245.180 2. Port: 5432 3. User: bucardo 4. Database: bucardo 5. PID directory: /var/run/bucardo Enter a number to change it, P to proceed, or Q to quit: P Attempting to create and populate the bucardo database and schema Database creation is complete Updated configuration setting "piddir" Installation is now complete. If you see errors or need help, please email bucardo-general@bucardo.org You may want to check over the configuration variables next, by running: bucardo show all Change any setting by using: bucardo set foo=bar
JavaScript
복사
데이터 베이스 동기화
데이터 베이스 그룹
[opensql@localhost:~]$ bucardo add database server1 dbname=test Added database "server1" [opensql@localhost:~]$ bucardo add database server2 dbname=test host=192.168.245.181 Added database "server2"
JavaScript
복사
테이블 그룹
[opensql@localhost:~]$ bucardo add all tables --her=testSrv1 db=server1 Creating relgroup: testSrv1 Added table public.good1 to relgroup testSrv1 Added table public.pgbench_accounts to relgroup testSrv1 Added table public.pgbench_branches to relgroup testSrv1 Added table public.pgbench_tellers to relgroup testSrv1 New tables added: 4 [opensql@localhost:~]$ bucardo add all tables --her=testSrv2 db=server2 Creating relgroup: testSrv2 Added table public.good1 to relgroup testSrv2 Added table public.pgbench_accounts to relgroup testSrv2 Added table public.pgbench_branches to relgroup testSrv2 Added table public.pgbench_tellers to relgroup testSrv2 New tables added: 4 [opensql@localhost:~]$ bucardo list relgroup Relgroup: testSrv1 DB: server1 Members: public.good1, public.pgbench_accounts, public.pgbench_branches, public.pgbench_tellers Relgroup: testSrv2 DB: server2 Members: public.good1, public.pgbench_accounts, public.pgbench_branches, public.pgbench_tellers
JavaScript
복사
Sync
[opensql@localhost:~]$ bucardo add sync testdbSrv1 relgroup=testSrv1 db=server1,server2 Added sync "testdbSrv1" Created a new dbgroup named "testdbSrv1" [opensql@localhost:~]$ bucardo add sync testdbSrv2 relgroup=testSrv2 db=server2,server1 Added sync "testdbSrv2" Created a new dbgroup named "testdbSrv2" [opensql@localhost:~]$ bucardo list sync Sync "testdbSrv1" Relgroup "testSrv1" [Active] DB group "testdbSrv1" server1:source server2:target Sync "testdbSrv2" Relgroup "testSrv2" [Active] DB group "testdbSrv2" server1:target server2:source
JavaScript
복사
bucardo 실행 및 확인
bucardo start sync bucardo status PID of Bucardo MCP: 53734 Name State Last good Time Last I/D Last bad Time ============+========+=======================+============+===========+===========+======= testdbSrv1 | Good | Jun 07, 2023 20:50:23 | 3h 37m 53s | 0/0 | none | testdbSrv2 | Good | Jun 07, 2023 20:50:23 | 3h 37m 53s | 0/0 | none |
JavaScript
복사
지금까지 PostgreSQL의 bucardo에 관해 알아보았습니다
‘PostgreSQL의 pgpool-II (1)’를 바로 이어서 확인해보세요!

자유롭게 댓글을 남겨주세요