pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julie Nishimura <juliezain@hotmail.com>
To: Alban Hertroys <haramrae@gmail.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: adding more space to the existing server
Date: Mon, 5 Aug 2019 15:27:57 +0000
Message-ID: <BYAPR08MB5014ACAC05363CDF09DC67C2ACDA0@BYAPR08MB5014.namprd08.prod.outlook.com> (raw)
In-Reply-To: <CAF-3MvPS2r2ZQdSFOTMW3LzfMZYKGB8J0XsuvW7Agj60xQ5PpA@mail.gmail.com>
References: <BYAPR08MB50148CE9EA5DB6321948BD7EACDF0@BYAPR08MB5014.namprd08.prod.outlook.com>
	<b484082e-82b6-28fd-562f-3fade5360c46@aklaver.com>
	<BYAPR08MB5014E634BC405CF9705BF37DACD90@BYAPR08MB5014.namprd08.prod.outlook.com>
	<13358DF7-5700-44A2-A86B-2A3721AA9650@gmail.com>
	<BYAPR08MB5014D1F3B0F81D2584AB96CFACDB0@BYAPR08MB5014.namprd08.prod.outlook.com>
	<CAF-3MvPS2r2ZQdSFOTMW3LzfMZYKGB8J0XsuvW7Agj60xQ5PpA@mail.gmail.com>

Thanks for your reply Alban. Currently we only have A->B replication. Is adding B->C replication difficult? I remember in the past I tried to seed pg_basebackup from hot standby, and it was erroring out after awhile, so needed to switch to run from master.

________________________________
From: Alban Hertroys <haramrae@gmail.com>
Sent: Monday, August 5, 2019 5:01 AM
To: Julie Nishimura <juliezain@hotmail.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>; pgsql-general <pgsql-general@postgresql.org>
Subject: Re: adding more space to the existing server


On 5 Aug 2019, at 0:39, Julie Nishimura <juliezain@hotmail.com<mailto:juliezain@hotmail.com>> wrote:

Alban, thank you for your reply. Your suggestion makes sense, and I will be talking to our engineers about it. Currently we need to understand:

a)       How do we break A -> B replication such that both can become independent primaries

That is pretty much like normal failover from A to B, except that you don’t reverse replication.

You will need to stop your clients from sending data for a bit (if it’s continuous data, having a buffer in between is a big help - at our company we’re looking into Apache Kafka for that), so that you can switch half of them to connect to B instead of A.

Next, you promote B to master. I used the docs for that last time, and they were pretty clear on the subject.


b)      How do we reassign C from B->C replication to A->C replication

I don’t think you need to. If you indeed already have A->B->C, after promoting B to master, you end up with B->C, which is alright.
You just need to add A->D for the other set.

c)       Thoughts on why this isn’t a good plan

That depends on your clients and how you decide which database in the current cluster they connect to. If you connect specific clients to specific databases, then all you need to do is to configure half your clients to connect to B instead.

Another option is to put a virtual database layer in front, such that both clusters still look like a single database to the outside world. We have some experience with Dremio for similar purposes (although for read-only reporting). Mind that the community edition doesn’t do authorization.

Current:
 A replicates to B
all requests go to A

Soon:
  A replicates to B -> cascading to C and D

Transition:
  break A replication to B such that both can become primary
Correct.
  stop B replication to C  then setup A to replicate to C
I would change this in:
   setup A to replicate to D

End state:
A replicates to C
B replicates to D

End state:
A replicates to D
B replicates to C

we remove some of the dbs from A and B, then reassign the traffic based on db selections

I hope it all makes sense...

Thank you
It does to me. Now would be a good time for people to chime in if they don't agree ;)


From: Alban Hertroys <haramrae@gmail.com<mailto:haramrae@gmail.com>>
Sent: Saturday, August 3, 2019 3:15 AM
To: Julie Nishimura <juliezain@hotmail.com<mailto:juliezain@hotmail.com>>
Cc: Adrian Klaver <adrian.klaver@aklaver.com<mailto:adrian.klaver@aklaver.com>>; pgsql-general@lists.postgresql.org<mailto:pgsql-general@lists.postgresql.org> <pgsql-general@lists.postgresql.org<mailto:pgsql-general@lists.postgresql.org>>; pgsql-general <pgsql-general@postgresql.org<mailto:pgsql-general@postgresql.org>>
Subject: Re: adding more space to the existing server


> On 2 Aug 2019, at 21:45, Julie Nishimura <juliezain@hotmail.com<mailto:juliezain@hotmail.com>> wrote:

> 1) We use streaming replication, and due to hardware limitation, we cannot add more drives to the existing host. That is why we thought by breaking the existing streaming replication (from a->b), instead of currently identical standby (b), we can introduce twice larger host, then start the replication to the newly larger host, and when it is caught up, break it again. Then break rep again, make modification to 'a" host, making it larger, then replicate b->a. After it is caught up, break the rep again, switch master->standby (if necessary).

Let’s be clear, I’m in no way an expert on replication. In fact, I’ve only done (streaming) replication once and I managed to mess that up in a minor way (disabled the wrong service during failover, so data still went to the database I was attempting to replace for, like, 15 minutes).

> 2) I am not sure about the time, but it is understood it is required 2 full replication cycles, and might be up to 2 weeks with no standby situation

No standby situation? Murphy is probably just waiting for that to strike…
I recall a fairly recent story on the FreeBSD ML about someone on Malta doing a migration of a couple dozen terabytes from her main server (because of some failing disks in her RAID set) using her backup server to move data around (with backups removed to make room), when, due to an accident outside the building, an aerial 10KV power line hit another power line in the ground, causing a fire in one UPS and frying the other one. Losing power at that point meant that the file systems (ZFS) on both servers ended up in an unrecoverable state with no backups. It didn’t help that the UPS’s were at the bottom of the rack, with the heat and smoke going up into the servers. What are the chances, right? (And then it turned out that it is really hard to try to recover data from a ZFS file system in such a state, which is what her actual inquiry was about)

I would definitely prefer to add a 3rd machine into the mix, even if it were just a temporary machine - a rental perhaps?

view thread (11+ messages)  latest in thread

Message-ID: <BYAPR08MB5014ACAC05363CDF09DC67C2ACDA0@BYAPR08MB5014.namprd08.prod.outlook.com>
Permalink:  ../BYAPR08MB5014ACAC05363CDF09DC67C2ACDA0@BYAPR08MB5014.namprd08.prod.outlook.com/
Also on:    postgresql.org/message-id/BYAPR08MB5014ACAC05363CDF09DC67C2ACDA0@BYAPR08MB5014.namprd08.prod.outlook.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: juliezain@hotmail.com, haramrae@gmail.com, adrian.klaver@aklaver.com
  Subject: Re: adding more space to the existing server
  In-Reply-To: <BYAPR08MB5014ACAC05363CDF09DC67C2ACDA0@BYAPR08MB5014.namprd08.prod.outlook.com>
  References: <BYAPR08MB50148CE9EA5DB6321948BD7EACDF0@BYAPR08MB5014.namprd08.prod.outlook.com> <b484082e-82b6-28fd-562f-3fade5360c46@aklaver.com> <BYAPR08MB5014E634BC405CF9705BF37DACD90@BYAPR08MB5014.namprd08.prod.outlook.com> <13358DF7-5700-44A2-A86B-2A3721AA9650@gmail.com> <BYAPR08MB5014D1F3B0F81D2584AB96CFACDB0@BYAPR08MB5014.namprd08.prod.outlook.com> <CAF-3MvPS2r2ZQdSFOTMW3LzfMZYKGB8J0XsuvW7Agj60xQ5PpA@mail.gmail.com> <BYAPR08MB5014ACAC05363CDF09DC67C2ACDA0@BYAPR08MB5014.namprd08.prod.outlook.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox