PostgreSQL的OGG -- bucardo
perl Makefile.PL
make
make install
log_conflict_file = /home/postgres/log/bucardo_conflict.log
piddir = /home/postgres/run
reason_file = /home/postgres/log/bucardo.restart.reason.log
warning_file = /home/postgres/log/bucardo.warning.log
4. 初始化bucardo
[postgres@sdserver40_222 ~]$ bucardo 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:
. Host: <none>
. Port:
. User: postgres
. Database: bucardo
. PID directory: /home/postgres/run
Enter a number to change it, P to proceed, or Q to quit: Change the host to: 127.0.0.1 Changed host to: 127.0.0.1
Current connection settings:
. Host: 127.0.0.1
. Port:
. User: postgres
. Database: bucardo
. PID directory: /home/postgres/run
Enter a number to change it, P to proceed, or Q to quit: Change the database name to: mydb Changed database name to: mydb
Current connection settings:
. Host: 127.0.0.1
. Port:
. User: postgres
. Database: mydb
. PID directory: /home/postgres/run
Enter a number to change it, P to proceed, or Q to quit: P Postgres version is: 9.5
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
[postgres@sdserver40_222 ~]$ bucardo add db db1 dbname=mydb host=127.0.0.1 port= user=postgres
Added database "db1"
[postgres@sdserver40_222 ~]$ bucardo add db db2 dbname=mydb host=192.168.1.202 port= user=postgres
Added database "db2"
1)若添加若有表则用 all tables;
2) 只能同步存在主键的table;像这里的lottu01我是没建主键的;下面添加同步步骤会出现错误。
4. 添加同步
[postgres@sdserver40_222 ~]$ bucardo add sync sync1 relgroup=relgroup1 dbs=dbgroup1
Added sync "sync1"
Failed to add sync: DBD::Pg::st execute failed: ERROR: Table "public.lottu01" must specify a primary key! at line . at line .
CONTEXT: PL/Perl function "validate_sync" at /usr/local/bin/bucardo line
add sync:
bucardo add sync name relgroup=xxx dbs=xxx Adds a sync, which is a named replication event containing information
about what to replicate from where to where. The supported parameters
are: "dbs"
The name of a dbgroup or comma-delimited list of databases. All of
the specified databases will be synchronized. Required. "dbgroup"
The name of a dbgroup. All of the databases within this group will
be part of the sync. If the dbgroup does not exists and a separate
list of databases is given, the group will be created and populated. "relgroup"
The name of a relgroup to synchronize. All of the tables and/or
sequences in the relgroup will be synchronized. Required unless
"tables" is specified. "tables"
List of tables to add to the sync. This implicitly creates a
relgroup with the same name as the sync. Required unless "relgroup"
is specified. "status"
Indicates whether or not the sync is active. Must be either "active"
or "inactive". Defaults to "active". "rebuild_index"
Boolean indicating whether or not to rebuild indexes after every
sync. Defaults to off. "lifetime"
Number of seconds a KID can live before being reaped. No limit by
default. "maxkicks"
Number of times a KID may be kicked before being reaped. No limit by
default. "conflict_strategy"
The conflict resolution strategy to use in the sync. Supported
values: "bucardo_source"
The rows on the "source" database always "win". In other words,
in a conflict, Bucardo copies rows from source to target. "bucardo_target"
The rows on the "target" database always win. "bucardo_skip"
Any conflicting rows are simply not replicated. Not recommended
for most cases. "bucardo_random"
Each database has an equal chance of winning each time. This is
the default. "bucardo_latest"
The row that was most recently changed wins. "bucardo_abort"
The sync is aborted on a conflict. "onetimecopy"
Determines whether or not a sync should switch to a full copy mode
for a single run. Supported values are: : off
: always full copy
: only copy tables that are empty on the target "stayalive"
Boolean indicating whether or not the sync processes (CTL) should be
persistent. Defaults to false. "kidsalive"
Boolean indicating whether or not the sync child processes (KID)
should be persistent. Defaults to false. "autokick"
Boolean indicating whether or not tables in the sync should
automatically send kick messages when they're modified. May be
overridden by the "autokick" parameter of individual tables. "checktime"
An interval specifying the maximum time a sync should go before
being kicked. Useful for busy systems where you don't want the
overhead of notify triggers. "priority"
An integer indicating the priority of the sync. Lower numbers are
higher priority. Currently used only for display purposes. "analyze_after_copy"
Boolean indicating whether or not to analyze tables after every
sync. Off by default. Optional. "overdue"
An interval specifying the amount of time after which the sync has
not run that it should be considered overdue. "check_bucardo_sync"
issues a warning when a sync has not been run in this amount of
time. "expired"
An interval specifying the amount of time after which the sync has
not run that it should be considered expired. "check_bucardo_sync"
issues a critical message when a sync has not been run in this
amount of time. "track_rates"
Boolean indicating whether or not to track synchronization rates. "rebuild_index"
Boolean indicating whether or not to rebuild indexes after every
sync. Off by default. Optional. "strict_check"
Boolean indicating whether or not to be strict when comparing tables
in the sync. If the columns have different names or data types, the
validation will fail. But perhaps the columns are allowed to have
different names or data types. If so, disable "strict_check" and
column differences will result in warnings rather than failing the
validation. Defaults to true.
5. 启动bucardo
bucardo start
bucardo stop
bucardo restart
[postgres@sdserver40_222 ~]$ psql mydb
psql (9.5.)
Type "help" for help.
mydb=# delete from lottu03;
DELETE mydb=# insert into lottu03 values (1001,'bucardo');
INSERT
在目标库查看
[postgres@sdserver40_210 ~]$ psql mydb
psql (9.5.)
Type "help" for help. mydb=# select * from lottu03;
id | name
------+---------
| bucardo
( row)
Creating superuser 'bucardo'
Attempting to create and populate the bucardo database and schema INSTALLATION FAILED! (psql:/usr/local/share/bucardo/bucardo.schema:: ERROR: language "plperlu" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.)
解决方法;看提示知道需要“create language plperlu;”但是在我的环境之下
mydb=# create language plperlu;
ERROR: could not access file "$libdir/plperl": No such file or directory
postgres=# CREATE LANGUAGE plperlu;
CREATE LANGUAG
install_driver(Pg) failed: DBI version 1.614 required--this is only version 1.609 at /usr/share/perl5/Exporter/Heavy.pm line , <> line .
Compilation failed in require at (eval ) line , <> line .
perl: symbol lookup error: /usr/local/lib64/perl5/auto/DBD/Pg/Pg.so: undefined symbol: DBIc_AIADESTROY
Checking for existing processes
Can't locate boolean.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/share/perl5/Bucardo.pm line 34.
BEGIN failed--compilation aborted at /usr/local/share/perl5/Bucardo.pm line 34.
Compilation failed in require at /usr/local/bin/bucardo line 833.
解决方法: yum install perl-boolean
PostgreSQL的OGG -- bucardo的更多相关文章
- 使用ogg实现oracle到postgresql表的实时同步
参考:https://docs.oracle.com/goldengate/c1221/gg-winux/index.html https://blog.51cto.com/hbxztc/188071 ...
- OGG For Oracle To PostgreSQL
本文档描述OGG(Oracle goldengate)为Oracle同步到PostgreSQL数据库配置.在目前去“IOE”潮流.PostgreSQL确实是Oracle最好的替代品之一. 实验环境如下 ...
- 配置ogg从Oracle到PostgreSQL的同步复制json数据
标签:goldengate postgresql oracle json 测试环境说明 Oracle:Windows 8.1 + Oracle 12.2.0.1.0 + GoldenGate 12.3 ...
- PostgreSQL高可用性、负载均衡、复制与集群方案介绍
目录[-] 一.高可用性.负载均衡.复制的几个方案比较: 二.多节点集群方案比较 9.3官方文档(中文):http://58.58.27.50:8079/doc/html/9.3.1_zh/high- ...
- PostgreSQL and bloat
The bucardo project has released its nagios plugins for PostgreSQL and we can extract from them this ...
- Top PG Clustering HA Solutions for PostgreSQL
转自:https://severalnines.com/blog/top-pg-clustering-ha-solutions-postgresql If your system relies on ...
- PostgreSQL逻辑复制之pglogical篇
PostgreSQL逻辑复制之slony篇 一.pglogical介绍 pglogical 是 PostgreSQL 的拓展模块, 为 PostgreSQL 数据库提供了逻辑流复制发布和订阅的功能. ...
- PostgreSQL Replication之第六章 监控您的设置(4)
6.4 处理监控工具 还有几个监控工具可以使您的日常生活更轻松. 其中最流行的监控工具是Nagios.它被广泛地使用,也支持各种软件组件. 要使用 Nagios 来监控您的 PostgreSQL 集群 ...
- PostgreSQL、Greenplum 日常监控 和 维护任务
背景 Greenplum的日常监控点.评判标准,日常维护任务. 展示图层 由于一台主机可能跑多个实例,建议分层展示. 另外,即使是ON ECS虚拟机(一个虚拟机一个实例一对一的形态)的产品形态,实际上 ...
随机推荐
- C++强制类型转换
C语言强制类型转换过于粗暴,任意类型之间都可以进行转换,编译很难判断其正确性; 难于定位,在源码中无法快速定位所有使用强制类型转换的语句. C++将强制类型转换分为4种不同的类型:static_cas ...
- js 小知识
在iframe 页面获取父级页面的 html var obj = window.parent.document.getElementById('modaliframe'); 解决Jquery 的在一个 ...
- 《linux内核设计与实现》读书笔记第十七章
第17章 设备与模块 四种内核成分 设备类型:在所有 Unix 系统中为了统一普通设备的操作所采用的分类. 模块: Linux 内核中用于按需加载和卸载目标码的机制. 内核对象:内核数据结构中支持面向 ...
- CodeIgniter 下引入ORM Doctrine
做了两年的CI开发,一直使用activeRecord来操作数据库.简单,轻巧加方便.最近一个项目交给手下去做,也是采用从数据库设计入手的开发流程,现在已经上线运行.经历了理清需求,设计数据库,在CI中 ...
- CSS之元素选择器
1.后代元素选择器 div p 以空格分隔,表示div的所有后代p元素 2.子元素选择器 div > p 以大于号分隔,表示div的直接子元素 3.相邻兄弟选择器 div + p 选择紧接在d ...
- swiper.animate~之~可以执行两种动画的升级版的Swiper Animate
1.下载插件swiper.animate-twice.min.js,加载进页面. <!DOCTYPE html> <html> <head> ... < ...
- 采用阿里的API进行动态域名解析
#!/usr/bin/env python # -*- coding:utf-8 -*- import os from aliyunsdkcore import client from aliyuns ...
- Apache+Tomcat配置方法
一. 修改应用服务器的server文件: 1.找到wizbank项目下的conf文件夹,打开server文件,加入以下内容: <Connector port="8009" p ...
- 【原创】JMeter学习(三十七)Jmeter录制手机app脚本
环境准备: 1.手机 2.wifi 3.Jmeter 具体步骤: 1.启动Jmeter: 2.“测试计划”中添加“线程组”: 3.“工作台”中添加“HTTP代理服务器”: 4.配置代理服务器:Gl ...
- python基础:算法是什么
"算法"是什么? 简单来说,算法就是告诉计算机要做什么,是对如何做一件事情的详细描述或者详细的操作步骤. 待补充~~~