It's a guidance to setup pgcapture environment by docker.
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)
- 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
- Run the consumer
go run consumer/main.go
- 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"}');
- See the consumer output from postgres source change
- 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
- Run the consumer
go run consumer/main.go
- 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"}');
- See the consumer output from postgres source change
- Run scheduler to dump change to consumer
go run scheduler/main.go
- See the consumer output from scheduler dump change
You can use postgres folder to custom your postgres version with pglogcial and pgcapture extensions.