我已经使用以下软件版本配置了两台具有冗余配置(主-主设置)的 RHEL 计算机。
数据库复制会顺利进行到某个时间点,之后复制突然停止。我可以在布卡多日志中看到以下类型的语句。
*KID (database_sync) Conflicts for public.interface: 4
KID (database_sync) Conflicts have been resolved
KID (database_sync) Warning! Aborting due to exception for public.interface:? Error was DBD::Pg::db pg_putcopyend failed: ERROR: duplicate key value violates unique constraint "interface_nodeid_ifindex_unique_idx"\nDETAIL: Key (nodeid, ifindex)=(81, 1) already exists.\nCONTEXT: COPY interface, line 2 at /usr/share/perl5/vendor_perl/Bucardo.pm line 9879.
KID (database_sync) Kid has died, error is: DBD::Pg::db pg_putcopyend failed: ERROR: duplicate key value violates unique constraint "interface_nodeid_ifindex_unique_idx"\nDETAIL: Key (nodeid, ifindex)=(81, 1) already exists.\nCONTEXT: COPY interface, line 2 at /usr/share/perl5/vendor_perl/Bucardo.pm line 9879. Line: 5041 Main DB state: ? Error: none DB database_node1 state: ? Error: none DB database_node2 state: 23505 Error: 7
DBI::db=HASH(0x2e1a708)->disconnect invalidates 9 active statement handles (either destroy statement handles or call finish on them before disconnecting) at /usr/share/perl5/vendor_perl/Bucardo.pm line 2756.
DBI::db=HASH(0x2e1a828)->disconnect invalidates 9 active statement handles (either destroy statement handles or call finish on them before disconnecting) at /usr/share/perl5/vendor_perl/Bucardo.pm line 2756.
KID (database_sync) Kid 22825 exiting at cleanup_kid. Sync "database_sync" public.interface Reason: DBD::Pg::db pg_putcopyend failed: ERROR: duplicate key value violates unique constraint "interface_nodeid_ifindex_unique_idx"\nDETAIL: Key (nodeid, ifindex)=(81, 1) already exists.\nCONTEXT: COPY interface, line 2 at /usr/share/perl5/vendor_perl/Bucardo.pm line 9879. Line: 5041 Main DB state:
?错误:无数据库database_node1状态:?错误:无数据库database_node2状态:23505错误:7 MCP 开始 check_sync_health*
以下是我创建同步所遵循的步骤。
bucardo add database bucardo add table all --db="$database"_node1 --herd="$database"_herd
bucardo add sequence all --db="$database"_node1 --herd="$database"_herd
bucardo add dbgoup "$database"_group
bucardo add dbgroup "$database"_group "$database"_node1:source
bucardo add dbgroup "$database"_group "$database"_node2:source
bucardo add sync "$database"_sync herd="$database_herd"_herd dbs="$database"_group conflict_strategy=bucardo_latest onetimecopy=2 stayalive=1 kidsalive=1 autokick=1 systemctl enable bucardo.service
您能帮助我了解您对该问题的发现吗? 我的数据库中的序列可以负责在数据库中创建重复条目吗?
使用带有布卡多序列的多源设置时不得重复,否则会在您已经尝试过的情况下出现冲突。
bucardo remove sequence all
bucardo validate all
bucardo reload