Skip to content

replicase/docker-pgcapture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

830dfe2 · Oct 6, 2023

History

28 Commits
Sep 18, 2023
Sep 30, 2023
Oct 6, 2023
Mar 2, 2023
Sep 18, 2023
Jan 29, 2023
Oct 4, 2023
Sep 4, 2023
Aug 20, 2023
Oct 6, 2023
Oct 6, 2023
Oct 4, 2023

Repository files navigation

docker-pgcapture

It's a guidance to setup pgcapture environment by docker.

Build pgcapture image

Build pgcapture image if you do not have pgcapture image in your local environment. And you can change the pgcapture version in dockerbuild.sh.

  (cd pgcapture && ./dockerbuild.sh)

Demo CDC Consumer

  1. Run the script
    # default postgres version is 14 and decode plugin is pgoutput
    # you can specify postgres version and decode plugin by setting environment variables
    # example: POSTGRES_VERSION=11 DECODE_PLUGIN=pglogical_output ./demo-consumer.sh
    ./demo-consumer.sh
  2. Run the consumer
    go run consumer/main.go
  3. Connect localhost:5432 postgres and create users table and insert data
    create table users (id int primary key, name text not null, uid uuid not null, info jsonb not null, addresses text[] not null);
    insert into users(id, name, uid, info) values (1, 'foo', 'bc03d615-8afb-452d-b0cc-340087def732', '{"myAge": 18}', '{"taipei", "hsinchu"}'); 
  4. See the consumer output from postgres source change

Demo CDC Consumer and Scheduler Dump

  1. Run the script
    # default postgres version is 14 and decode plugin is pgoutput
    # you can specify postgres version and decode plugin by setting environment variables
    # example: POSTGRES_VERSION=11 DECODE_PLUGIN=pglogical_output ./demo-scheduler.sh
    ./demo-scheduler.sh
  2. Run the consumer
    go run consumer/main.go
  3. Connect localhost:5432 postgres and create users table and insert data
    create table users (id int primary key, name text not null, uid uuid not null, info jsonb not null, addresses text[] not null);
    insert into users(id, name, uid, info) values (1, 'foo', 'bc03d615-8afb-452d-b0cc-340087def732', '{"myAge": 18}', '{"taipei", "hsinchu"}'); 
  4. See the consumer output from postgres source change
  5. Run scheduler to dump change to consumer
    go run scheduler/main.go
  6. See the consumer output from scheduler dump change

How to change Postgres image version

You can use postgres folder to custom your postgres version with pglogcial and pgcapture extensions.

About

Demo pgcapture amazing library by docker !

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published