You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is only needed after changes to the ProtoBuf definition (_proto/pg_logicaldec.proto):
62
71
63
-
cd proto
64
-
protoc-c --c_out=../src/proto pg_logicaldec.proto
65
-
cd ..
72
+
```bash
73
+
cd proto
74
+
protoc-c --c_out=../src/proto pg_logicaldec.proto
75
+
cd ..
76
+
```
66
77
67
78
Commit the generated files to git then.
68
79
@@ -71,49 +82,58 @@ Commit the generated files to git then.
71
82
If you have multiple Postgres versions installed, you can select which version to install decoderbufs into by altering your `$PATH` to point to the right version.
72
83
Then `make` and `make install` for each version. Here is an example:
73
84
74
-
# Install for Postgres 9.6 if I have multiple local versions
75
-
export PATH=/usr/lib/postgresql/9.6/bin:$PATH
76
-
make
77
-
make install
85
+
```bash
86
+
# Install for Postgres 9.6 if I have multiple local versions
87
+
export PATH=/usr/lib/postgresql/9.6/bin:$PATH
88
+
make
89
+
make install
90
+
```
78
91
79
92
Once the extension has been installed you just need to enable it and logical replication in postgresql.conf:
#wal_sender_timeout = 60s # in milliseconds; 0 disables
103
+
max_replication_slots = 4 # max number of replication slots (change requires restart)
104
+
```
90
105
91
106
In addition, permissions will have to be added for the user that connects to the DB to be able to replicate. This can be modified in _pg\_hba.conf_ like so:
92
107
93
-
local replication <youruser> trust
94
-
host replication <youruser> 127.0.0.1/32 trust
95
-
host replication <youruser> ::1/128 trust
96
-
108
+
```make
109
+
local replication <youruser> trust
110
+
host replication <youruser> 127.0.0.1/32 trust
111
+
hostreplication<youruser> ::1/128 trust
112
+
```
113
+
97
114
And restart PostgreSQL.
98
115
99
116
## Usage
100
-
-- can use SQL for demo purposes
101
-
select * from pg_create_logical_replication_slot('decoderbufs_demo', 'decoderbufs');
102
-
103
-
-- DO SOME TABLE MODIFICATIONS (see below about UPDATE/DELETE)
104
-
105
-
-- peek at WAL changes using decoderbufs debug mode for SQL console
106
-
select data from pg_logical_slot_peek_changes('decoderbufs_demo', NULL, NULL, 'debug-mode', '1');
107
-
-- get WAL changes using decoderbufs to update the WAL position
108
-
select data from pg_logical_slot_get_changes('decoderbufs_demo', NULL, NULL, 'debug-mode', '1');
109
-
110
-
-- check the WAL position of logical replicators
111
-
select * from pg_replication_slots where slot_type = 'logical';
117
+
118
+
```sql
119
+
-- can use SQL for demo purposes
120
+
select * from pg_create_logical_replication_slot('decoderbufs_demo', 'decoderbufs');
121
+
122
+
-- DO SOME TABLE MODIFICATIONS (see below about UPDATE/DELETE)
123
+
124
+
-- peek at WAL changes using decoderbufs debug mode for SQL console
125
+
select data from pg_logical_slot_peek_changes('decoderbufs_demo', NULL, NULL, 'debug-mode', '1');
126
+
-- get WAL changes using decoderbufs to update the WAL position
127
+
select data from pg_logical_slot_get_changes('decoderbufs_demo', NULL, NULL, 'debug-mode', '1');
128
+
129
+
-- check the WAL position of logical replicators
130
+
select * from pg_replication_slots where slot_type = 'logical';
131
+
```
112
132
113
133
If you're performing an UPDATE/DELETE on your table and you don't see results for those operations from logical decoding, make sure you have set [REPLICA IDENTITY](http://www.postgresql.org/docs/9.4/static/sql-altertable.html#SQL-CREATETABLE-REPLICA-IDENTITY) appropriately for your use case.
114
-
134
+
115
135
The binary format will be consumed by the Debezium Postgres Connector.
116
-
136
+
117
137
## Type Mappings
118
138
119
139
The following table shows how current PostgreSQL type OIDs are mapped to which decoderbuf fields:
@@ -144,5 +164,5 @@ The following table shows how current PostgreSQL type OIDs are mapped to which d
144
164
145
165
## Support
146
166
147
-
File bug reports and feature requests using [Debezium's JIRA](https://issues.jboss.org/browse/DBZ) and the
167
+
File bug reports and feature requests using [Debezium's JIRA](https://issues.jboss.org/browse/DBZ) and the
0 commit comments