电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

PostgreSQL数据库双主同步VIP免费

PostgreSQL数据库双主同步_第1页
1/7
PostgreSQL数据库双主同步_第2页
2/7
PostgreSQL数据库双主同步_第3页
3/7
使用Bucardo搭建PG数据库同步1、Bucardo介绍Bucardo是针对PostgreSQL数据库开发的同步软件,可以实现PostgreSQL数据库的主从、主主、多主同步方案,不过bucardo中的同步都是异步的,它是通过触发器记录变化,甚至可以以postgresql为源库,可以和oracle、mysql、mongodb等很多数据库进行数据异步同步。2、Bucardo搭建前准备2.1搭建环境版本要求:Perl5(atleast5.8.3)Postgres(atleast8.2)DBImodule(atleast1.51)DBD::Pgmodule(atleast2.0.0)DBIx::Safemodule(atleast1.2.4)Linux版本cat/etc/redhat-releaseCentOSLinuxrelease7.9.2009(Core)2.2Perl安装(所有节点都需要安装)本次系统linux版本是7.6Perl是linux系统自带;默认版本是v5.16.1;可行[root@node3Bucardo]#perl-vThisisperl,v5.16.1(*)builtforx86_64-linux-thread-multi如果perl版本低于5.8则执行如下操作####需要安装perl-5https://www.cpan.org/src/README.htmlwgethttps://www.cpan.org/src/5.0/perl-5.28.0.tar.gztar-zxvfperl-5.28.0.tar.gzcdperl-5.28.0./ConfigureMakemakeinstall进行Configure时务必不要指定-d参数,其中有2个重要选项不能采用默认配置:Buildasharedlibperl.so(y/n)[n]这里要选YBuildathreadingPerl?[n]这里要选Y安装完成后登陆数据库查看plperl语言组件是否能正确运行:createlanguageplperlu;createlanguageplperl2.3安装postgreSQL(所有节点都需要安装)在编译的过程需要带上–with-perl;./configure--prefix=/pgsql--with-perl2.4安装Pl/PerlU(所有节点都安装)之前安装Pg时已经加入了--with-perl则不需要再在此安装)#yuminstallpostgresql-plperl3、安装依赖包(主节点安装)3.1安装DBImodule安装DBI依赖Test-Simple;#安装Test-SimpleTest-Simple下载地址https://metacpan.org搜索Test-Simple#解压Test-Simple源码包tar-zxvfTest-Simple-1.302183.tar.gz#进入Test-Simple目录进行安装cdTest-Simple-1.302183perlMakefile.PLmakemakeinstall#接下来安装DBI#下载地址:http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.630.tar.gztar-zxvfDBI-1.630.tar.gzcdDBI-1.630perlMakefile.PLmakemakeinstall3.2安装DBD::Pgmodule安装最新的DBD::Pg;需要依赖Time::HiRes#安装Time::HiRes下载地址:https://metacpan.org搜索Time::HiRestar-zxvfTime-HiRes-1.9764.tar.gzcdTime-HiRes-1.9764perlMakefile.PLmakemakeinstall#接下来安装DBD::Pg#安装DBD::Pg;需要确定已经安装PostgreSQL环境;即pg_config输出#加载PostgreSQL环境变量tar-zxvfDBD-Pg-3.14.2.tar.gzcdDBD-Pg-3.14.2perlMakefile.PLmakemakeinstall3.3安装DBIx::Safe#下载地址:https://bucardo.org/DBIx-Safe/tar-zxvfDBIx-Safe-1.2.5.tar.gzcdDBIx-Safe-1.2.5perlMakefile.PLmakemakeinstall4、安装Bucardo#在网站https://bucardo.org/Bucardo/下载tar-zxvfBucardo-5.6.0.tar.gzcdBucardo-5.6.0perlMakefile.PLmakemakeinstall#查看Bucardo版本[postgres@node3~]$bucardo--versionbucardoversion5.6.05、创建bucardo元数据库5.1创建.bucardorc文件在系统用户home目录下创建;内容如下:log_conflict_file/home/postgres/bucardo/log/bucardo_conflict.logpiddir=/home/postgres/bucardo/runreason_file/home/postgres/bucardo/log/bucardo.restart.reason.logwarning_file/home/postgres/bucardo/log/bucardo.warning.logsyslog_facility=LOG_LOCAL1===5.2创建所需的目录及数据库mkdir-p/home/postgres/bucardo/logmkdir-p/home/postgres/bucardo/runmkdir-p/var/run/bucardochmod777/var/run/bucardo$psqlpostgres=#createuserbucardowithsuperuserpassword'bucardo';postgres=#createdatabasebucardowithowner=bucardo;5.3初始化bucardo管理库准备工作完成;开始执行bucardoinstall命令创建元数据库;#/usr/local/share/bucardo/bucardo.schema[postgres@node3~]$bucardoinstallThiswillinstallthebucardodatabaseintoanexistingPostgrescluster.PostgresmusthavebeencompiledwithPerlsupport,andyoumustconnectasasupe...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

PostgreSQL数据库双主同步

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部