Re: Seeded Replication

From: Lou Tseng <ltseng(at)advancedpricing(dot)com>
To: Pavan Teja <pavan(dot)postgresdba(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Seeded Replication
Date: 2019-04-03 14:41:32
Message-ID: DM6PR11MB29397A33E836DED35EB67BB6C4570@DM6PR11MB2939.namprd11.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Pavan,

This is the steps I took. I think I did it right:

[Master]

pg_dump -s -f schema.sql
pg_dump -a -f data.sql
CREATE PUBLICATION

[Client/Slave]

psql \i schema.sql
CREATE SUBSCRIPTION ... WITH (enabled = false)
SET session_replication_role = replica; -- turn off trigger
psql \i data.sql
ALTER SUBSCRIPTION ... ENABLE

--> errors occur here

Thoughts?

Lou Tseng

ltseng(at)advancedpricing(dot)com<mailto:ltseng(at)advancedpricing(dot)com>
[http://advancedpricing.com/wp-content/uploads/logo_AMPS_email.png]<http://www.advancedpricing.com/>
Advanced Medical Pricing Solutions<http://advancedpricing.com/>
35 Technology Parkway South, Suite. 100
Peachtree Corners, GA 30092

________________________________
From: Pavan Teja <pavan(dot)postgresdba(at)gmail(dot)com>
Sent: Wednesday, April 3, 2019 6:48 AM
To: Lou Tseng
Cc: pgsql-general(at)postgresql(dot)org >> PG-General Mailing List
Subject: Re: Seeded Replication

Hi Lou,

Did you restore data on the subscriber during the first time. If yes this error is likely to occur.

As a remedy, you need to restore only structural dump during initial building of subscription.

Earlier the same issue was faced by me later it got resolved following the above said approach.

Kindly revert back if any queries.

Regards,
Pavan Teja,
9841380956

On Wed, 3 Apr, 2019, 5:15 PM Lou Tseng, <ltseng(at)advancedpricing(dot)com<mailto:ltseng(at)advancedpricing(dot)com>> wrote:
Hi,

We are working on a project to set up replication from on premises Postgresql 10.4 to Azure Postgresql services. However, our database is about 200G and it will take a long time to complete the initial data copy. We would like to manually seed the subscriber database with data dump and then turn on the subscription like depesz showed in this post https://www.depesz.com/2017/02/07/waiting-for-postgresql-10-logical-replication/ . It works for the small testing database but when I applied same steps with entire database, I am getting "ERROR: duplicate key value violates unique constraint" errors. Basically postgresql does not recognize the primary key.

Any thought / suggestion is helpful!

Lou Tseng

ltseng(at)advancedpricing(dot)com<mailto:ltseng(at)advancedpricing(dot)com>
[http://advancedpricing.com/wp-content/uploads/logo_AMPS_email.png]<http://www.advancedpricing.com/>
Advanced Medical Pricing Solutions<http://advancedpricing.com/>
35 Technology Parkway South, Suite. 100
Peachtree Corners, GA 30092

In response to

Browse pgsql-general by date

  From Date Subject
Next Message rihad 2019-04-03 14:49:02 Re: Recommendation to run vacuum FULL in parallel
Previous Message Michael Lewis 2019-04-03 14:40:24 Re: Recommendation to run vacuum FULL in parallel