diff --git a/devtools/htap-setup-pg/pgpool2/docker-compose.yml b/devtools/htap-setup-pg/pgpool2/docker-compose.yml index 2988ce4b..c330542f 100644 --- a/devtools/htap-setup-pg/pgpool2/docker-compose.yml +++ b/devtools/htap-setup-pg/pgpool2/docker-compose.yml @@ -22,8 +22,6 @@ services: container_name: htap-pg-setup command: > sh -c " - PGPASSWORD=postgres psql -h pgsql -p 5432 -U postgres -d postgres -c \"CREATE PUBLICATION myduck_subscription FOR ALL TABLES;\" && - PGPASSWORD=postgres psql -h pgsql -p 5432 -U postgres -d postgres -c \"SELECT PG_CREATE_LOGICAL_REPLICATION_SLOT('myduck_subscription', 'pgoutput');\" && PGPASSWORD=postgres psql -h pgsql -p 5432 -U postgres -d postgres -c \"CREATE TABLE test (id INT PRIMARY KEY, name VARCHAR(255));\" && PGPASSWORD=postgres psql -h pgsql -p 5432 -U postgres -d postgres -c \"INSERT INTO test (id, name) VALUES (1, 'test');\" " @@ -37,8 +35,8 @@ services: pull_policy: always container_name: htap-myduck environment: - PGSQL_PRIMARY_DSN: postgres://postgres:postgres@pgsql:5432/postgres?sslmode=disable - PGSQL_SLOT_NAME: myduck_subscription + SETUP_MODE: REPLICA + SOURCE_DSN: postgres://postgres:postgres@pgsql:5432/postgres depends_on: pgsql: condition: service_healthy diff --git a/main.go b/main.go index 79e6cbdb..466f0cdc 100644 --- a/main.go +++ b/main.go @@ -51,9 +51,7 @@ var ( replicaOptions replica.ReplicaOptions - postgresPort = 5432 - postgresPrimaryDsn string - postgresSlotName = "myduck" + postgresPort = 5432 ) func init() { @@ -77,8 +75,6 @@ func init() { // The following options are used to configure the Postgres server. flag.IntVar(&postgresPort, "pg-port", postgresPort, "The port to bind to for PostgreSQL wire protocol.") - flag.StringVar(&postgresPrimaryDsn, "pg-primary-dsn", postgresPrimaryDsn, "The DSN of the primary server for logical replication.") - flag.StringVar(&postgresSlotName, "pg-slot-name", postgresSlotName, "The name of the logical replication slot to use.") } func ensureSQLTranslate() { @@ -152,9 +148,6 @@ func main() { if err != nil { logrus.WithError(err).Fatalln("Failed to create Postgres-protocol server") } - if postgresPrimaryDsn != "" && postgresSlotName != "" { - go pgServer.StartReplication(postgresPrimaryDsn, postgresSlotName) - } go pgServer.Start() }