31.9. Quick Setup

|           31.9. Quick Setup           |                              |                               |                  |                 |
|:-------------------------------------:|------------------------------|-------------------------------|------------------|-----------------|
|[Prev](logical-replication-config.html)|[Up](logical-replication.html)|Chapter 31. Logical Replication|[Home](index.html)| [Next](jit.html)|

---

## 31.9. Quick Setup

 First set the configuration options in `postgresql.conf`:

```
wal_level = logical

```

 The other required settings have default values that are sufficient for a basic setup.

`pg_hba.conf` needs to be adjusted to allow replication (the values here depend on your actual network configuration and user you want to use for connecting):

```
host     all     repuser     0.0.0.0/0     md5

```

 Then on the publisher database:

```
CREATE PUBLICATION mypub FOR TABLE users, departments;

```

 And on the subscriber database:

```
CREATE SUBSCRIPTION mysub CONNECTION 'dbname=foo host=bar user=repuser' PUBLICATION mypub;

```

 The above will start the replication process, which synchronizes the initial table contents of the tables `users` and `departments` and then starts replicating incremental changes to those tables.

---

|[Prev](logical-replication-config.html)|[Up](logical-replication.html)|              [Next](jit.html)             |
|:--------------------------------------|:----------------------------:|------------------------------------------:|
|     31.8. Configuration Settings      |      [Home](index.html)      | Chapter 32. Just-in-Time Compilation (JIT)|

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>