当前位置: 首页 > 工具软件 > Bucardo > 使用案例 >

postgresql multi-master 系列 Bucardo 之一 setup

柴耀
2023-12-01

os: centos 7.4
db: postgresql 11.7

bucardo可以实现postgresql的多主复制、主从同步,甚至可以以postgresql为源库,可以和oracle、mysql、mongodb等很多数据库进行数据异步同步。

看上去很强大,估计和 ogg 类似。

注意不支持 ddl 复制

192.168.56.111  bu1
192.168.56.112  bu2
192.168.56.113  bu3

版本

# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core) 
# 
# 
# yum list installed |grep -i postgresql
postgresql11.x86_64                11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-contrib.x86_64        11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-debuginfo.x86_64      11.5-1PGDG.rhel7                    @pgdg11  
postgresql11-devel.x86_64          11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-docs.x86_64           11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-libs.x86_64           11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-llvmjit.x86_64        11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-odbc.x86_64           12.01.0000-1PGDG.rhel7              @pgdg11  
postgresql11-plperl.x86_64         11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-plpython.x86_64       11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-plpython3.x86_64      11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-pltcl.x86_64          11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-server.x86_64         11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-tcl.x86_64            2.4.0-2.rhel7.1                     @pgdg11  
postgresql11-test.x86_64           11.7-1PGDG.rhel7                    @pgdg11 

# su - postgres
Last login: Wed Jan 15 18:34:12 CST 2020 on pts/0
$
$
$ psql -c "select version();"
                                                 version                                                 
---------------------------------------------------------------------------------------------------------
 PostgreSQL 11.7 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit
(1 row)

下载安装

有些依赖

REQUIREMENTS:
-------------

    build, test, and install Perl 5             (at least 5.8.3)
    build, test, and install Postgres           (at least 7.4)
    build, test, and install the DBI module     (at least 1.42)
    build, test, and install the DBD::Pg module (at least 1.48)

# yum install perl-boolean perl-DBI perl-DBD-Pg perl-Test-Simple \
perl-CGI perl-Pod-Parser perl-Sys-Syslog perl-Encode-Locale \
perl-Sys-Hostname-Long perl-ExtUtils-MakeMaker


# yum list installed |grep -Ei "perl-boolean|perl-dbi|perl-dbd"
perl-DBD-Pg.x86_64                 2.19.3-4.el7                        @base    
perl-DBD-SQLite.x86_64             1.39-3.el7                          @anaconda
perl-DBI.x86_64                    1.627-4.el7                         @anaconda
perl-boolean.noarch                0.30-1.el7                          @epel  

DBIx-Safe

# cd /tmp
# wget https://bucardo.org/downloads/DBIx-Safe-1.2.5.tar.gz
# tar -zxvf DBIx-Safe-1.2.5.tar.gz
# cd DBIx-Safe-1.2.5/
# export PATH=/usr/pgsql-11/bin:$PATH

# perl Makefile.PL
# make
# make test
# make install

check_postgres

# cd /tmp
# wget https://bucardo.org/downloads/check_postgres.tar.gz
# tar -zxvf ./check_postgres.tar.gz
# cd check_postgres-2.25.0
# perl Makefile.PL
# make
# env -i make test
# make install

Bucardo安装

# cd /tmp
# wget https://bucardo.org/downloads/Bucardo-5.6.0.tar.gz
# tar -zxvf Bucardo-5.6.0.tar.gz
# cd Bucardo-5.6.0
# perl Makefile.PL
# make
# make install

Installing /usr/local/share/perl5/Bucardo.pm
Installing /usr/local/share/man/man1/bucardo.1pm
Installing /usr/local/share/man/man3/Bucardo.3pm
Installing /usr/local/bin/bucardo
Installing /usr/local/share/bucardo/bucardo.schema
Appending installation info to /usr/lib64/perl5/perllocal.pod

以上操作三个节点上都需要分别执行一遍

参考:
http://bucardo.org
https://bucardo.org/Bucardo/Installation.html

 类似资料: