Replicate selected postgresql tables between two servers?

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.

Check out http://bucardo.org/wiki/Bucardo


Starting with Postgres 10, logical replication is built into Postgres! This is often a better solution than external solutions. The Postgres docs are great and easy to follow. It's very easy. See the quick setup docs, which in essense boils down to running this:

-- On publisher DB
CREATE PUBLICATION mypub FOR TABLE users, departments;

-- On subscriber DB
CREATE SUBSCRIPTION mysub CONNECTION 'dbname=foo host=bar user=repuser' PUBLICATION mypub;

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