在两台服务器之间复制选定的 postgresql 表?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11977381/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Replicate selected postgresql tables between two servers?
提问by Michael Guthrie
What would be the best way to replicate individual DB tables from a Master postgresql server to a slave machine? It can be done with cron+rsync, or with whatever postgresql might have build in, or some sort of OSS tool, but so far the postgres docs don't seem to cover howto do table replication. I'm not able to do a full DB replication because some tables have license->IP stuff connected to it, and I can't replicate those on the slave machine. I don't need instant replication, hourly would be acceptable as well.
将单个数据库表从主 postgresql 服务器复制到从机的最佳方法是什么?它可以通过 cron+rsync 或任何可能内置的 postgresql 或某种 OSS 工具来完成,但到目前为止 postgres 文档似乎没有涵盖如何进行表复制。我无法进行完整的数据库复制,因为某些表具有连接到它的许可证-> IP 内容,而且我无法在从机上复制这些内容。我不需要即时复制,每小时也可以接受。
If I need to just rsync, can someone help identify what files within the /var/lib/pgsql directory would need to be synced, or how I would know what tables they are.
如果我只需要 rsync,有人可以帮助确定 /var/lib/pgsql 目录中的哪些文件需要同步,或者我如何知道它们是什么表。
采纳答案by kgrittn
You cannot get anything useful by copying individual tables files in the data directory. If you want to replicate selected tables, there are a number of good options.
通过复制数据目录中的单个表文件,您无法获得任何有用的信息。如果要复制选定的表,有许多不错的选择。
http://wiki.postgresql.org/wiki/Replication,_Clustering,_and_Connection_Pooling
http://wiki.postgresql.org/wiki/Replication,_Clustering,_and_Connection_Pooling
回答by belidzs
You might want to try Bucardo, which is an open source software to synchronize rows between tables even if they are in a remote location. It's a very simple software, and it is capable of creating one-way synchronization relationships as well.
您可能想尝试 Bucardo,它是一种开源软件,即使它们位于远程位置,也可以在表之间同步行。这是一个非常简单的软件,它也能够创建单向同步关系。
Check out http://bucardo.org/wiki/Bucardo