Replication PostreSQL to Elasticsearch via Logical replication slots
Project description
Replication PostreSQL to Elasticsearch via Logical replication slots
Install
$ pip install pg-replicate-elastic
wal2json
Note: Use my fork as we tested it to be 100% sure it work with it and no breaking changes happen, wal2json .
$ git clone https://github.com/hmilkovi/wal2json.git
$ PATH=/path/to/bin/pg_config:$PATH
$ USE_PGXS=1 make
$ USE_PGXS=1 make install
You need to set up at least two parameters at postgresql.conf:
wal_level = logical
max_replication_slots = 1
After changing these parameters, a restart is needed.
Usage
pg_replicate_elastic --config=<absolute path to json config>
Construct configuration file in json format where:
- replication_slot json object for replication slot name and if is temporary
- tables is array of tables we want to replicate
- es_connection connection string to Elasticsearch
- postgres json object for PostreSQL connection
- inital_sync boolean for inital syncronization that needs to be done first time to replicate old data
Example configuration
{
"replication_slot": {
"name": "elasticsearch_slot",
"is_temp": true
},
"tables": [{
"name": "poc",
"primary_key": "a"
"exclude_columns": "c,z"
}],
"es_connection": "http://127.0.0.1:9200/",
"postgres": {
"port": 5432,
"host": "127.0.0.1",
"database": "poc",
"username": "test",
"password": "test"
},
"inital_sync": false
}
Note
wal2json is not my software so for licence check their licence
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pg-replicate-elastic-1.0.3.tar.gz.
File metadata
- Download URL: pg-replicate-elastic-1.0.3.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
908a25aff2ce65c05dff60510142b4ac24b3b7ac1597fb238b9465e80f654c6f
|
|
| MD5 |
e21e459cc0f9c5e93a7f5fe66fbd62ef
|
|
| BLAKE2b-256 |
11e3a82597fdde02b2ed9ea85c834073274cd9e5e4e65aea4c066b4e4bf54859
|
File details
Details for the file pg_replicate_elastic-1.0.3-py2-none-any.whl.
File metadata
- Download URL: pg_replicate_elastic-1.0.3-py2-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5343ea630030dcbcda4c24fc0fc408cf15de2c1792e54f3d2f1d002039f1677a
|
|
| MD5 |
6095cbc57a5bb797bdef00bb50c5d15c
|
|
| BLAKE2b-256 |
7766f5699e89037913f07e642f61b997d76402a82af5afcd943dde27ae04efa0
|