]> begriffs open source - ai-pg/blob - full-docs/txt/logical-replication-quick-setup.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / logical-replication-quick-setup.txt
1
2 29.14. Quick Setup #
3
4    First set the configuration options in postgresql.conf:
5 wal_level = logical
6
7    The other required settings have default values that are sufficient for
8    a basic setup.
9
10    pg_hba.conf needs to be adjusted to allow replication (the values here
11    depend on your actual network configuration and user you want to use
12    for connecting):
13 host     all     repuser     0.0.0.0/0     md5
14
15    Then on the publisher database:
16 CREATE PUBLICATION mypub FOR TABLE users, departments;
17
18    And on the subscriber database:
19 CREATE SUBSCRIPTION mysub CONNECTION 'dbname=foo host=bar user=repuser' PUBLICAT
20 ION mypub;
21
22    The above will start the replication process, which synchronizes the
23    initial table contents of the tables users and departments and then
24    starts replicating incremental changes to those tables.