]> begriffs open source - ai-pg/blob - full-docs/src/sgml/html/logical-replication-quick-setup.html
PG 18 docs from https://ftp.postgresql.org/pub/source/v18.0/postgresql-18.0-docs...
[ai-pg] / full-docs / src / sgml / html / logical-replication-quick-setup.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>29.14. Quick Setup</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="logical-replication-upgrade.html" title="29.13. Upgrade" /><link rel="next" href="jit.html" title="Chapter 30. Just-in-Time Compilation (JIT)" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">29.14. Quick Setup</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="logical-replication-upgrade.html" title="29.13. Upgrade">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="logical-replication.html" title="Chapter 29. Logical Replication">Up</a></td><th width="60%" align="center">Chapter 29. Logical Replication</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="jit.html" title="Chapter 30. Just-in-Time Compilation (JIT)">Next</a></td></tr></table><hr /></div><div class="sect1" id="LOGICAL-REPLICATION-QUICK-SETUP"><div class="titlepage"><div><div><h2 class="title" style="clear: both">29.14. Quick Setup <a href="#LOGICAL-REPLICATION-QUICK-SETUP" class="id_link">#</a></h2></div></div></div><p>
3    First set the configuration options in <code class="filename">postgresql.conf</code>:
4 </p><pre class="programlisting">
5 wal_level = logical
6 </pre><p>
7    The other required settings have default values that are sufficient for a
8    basic setup.
9   </p><p>
10    <code class="filename">pg_hba.conf</code> needs to be adjusted to allow replication
11    (the values here depend on your actual network configuration and user you
12    want to use for connecting):
13 </p><pre class="programlisting">
14 host     all     repuser     0.0.0.0/0     md5
15 </pre><p>
16   </p><p>
17    Then on the publisher database:
18 </p><pre class="programlisting">
19 CREATE PUBLICATION mypub FOR TABLE users, departments;
20 </pre><p>
21   </p><p>
22    And on the subscriber database:
23 </p><pre class="programlisting">
24 CREATE SUBSCRIPTION mysub CONNECTION 'dbname=foo host=bar user=repuser' PUBLICATION mypub;
25 </pre><p>
26   </p><p>
27    The above will start the replication process, which synchronizes the
28    initial table contents of the tables <code class="literal">users</code> and
29    <code class="literal">departments</code> and then starts replicating
30    incremental changes to those tables.
31   </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="logical-replication-upgrade.html" title="29.13. Upgrade">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="logical-replication.html" title="Chapter 29. Logical Replication">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="jit.html" title="Chapter 30. Just-in-Time Compilation (JIT)">Next</a></td></tr><tr><td width="40%" align="left" valign="top">29.13. Upgrade </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> Chapter 30. Just-in-Time Compilation (<acronym class="acronym">JIT</acronym>)</td></tr></table></div></body></html>