Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X4owA-0005vN-Ql for pgsql-admin@arkaria.postgresql.org; Wed, 09 Jul 2014 10:17:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X4ow9-0005OP-Us for pgsql-admin@arkaria.postgresql.org; Wed, 09 Jul 2014 10:17:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X4ow9-0005MX-0a for pgsql-admin@postgresql.org; Wed, 09 Jul 2014 10:17:17 +0000 Received: from mail-hk1ln0199.outbound.protection.outlook.com ([2a01:111:f400:7c1c::199] helo=APAC01-HK1-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X4ovx-00039a-97 for pgsql-admin@postgresql.org; Wed, 09 Jul 2014 10:17:15 +0000 Received: from HKXPR01MB247.apcprd01.prod.exchangelabs.com (10.242.120.24) by HKXPR01MB245.apcprd01.prod.exchangelabs.com (10.242.120.144) with Microsoft SMTP Server (TLS) id 15.0.980.8; Wed, 9 Jul 2014 10:16:27 +0000 Received: from HKXPR01MB247.apcprd01.prod.exchangelabs.com ([10.242.120.24]) by HKXPR01MB247.apcprd01.prod.exchangelabs.com ([10.242.120.24]) with mapi id 15.00.0980.000; Wed, 9 Jul 2014 10:16:27 +0000 From: David Morton To: "pgsql-admin@postgresql.org" Subject: Re: Safe to gracefully switch 9.2 streaming replication roles multiple times ? Thread-Topic: [ADMIN] Safe to gracefully switch 9.2 streaming replication roles multiple times ? Thread-Index: AQHPm17XzficNItUUUK7rBjHDElMTQ== Date: Wed, 9 Jul 2014 10:16:26 +0000 Message-ID: <82332E02-CCD2-406D-9B68-6E57AEC206B8@eroad.com> References: In-Reply-To: Accept-Language: en-NZ, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [125.236.209.148] x-microsoft-antispam: BCL:0;PCL:0;RULEID: x-forefront-prvs: 0267E514F9 x-forefront-antispam-report: SFV:NSPM; SFS:(6009001)(66654002)(189002)(377454003)(479174003)(24454002)(199002)(51704005)(83716003)(107886001)(74502001)(79102001)(74662001)(31966008)(107046002)(80022001)(92726001)(92566001)(85852003)(50986999)(36756003)(15202345003)(83072002)(54356999)(2656002)(4396001)(2351001)(87936001)(86362001)(110136001)(82746002)(99396002)(33656002)(21056001)(106116001)(85306003)(106356001)(105586002)(19580395003)(77982001)(15975445006)(66066001)(19580405001)(101416001)(20776003)(64706001)(81342001)(46102001)(76482001)(76176999)(95666004)(81542001)(83322001)(104396001); DIR:OUT; SFP:; SCL:1; SRVR:HKXPR01MB245; H:HKXPR01MB247.apcprd01.prod.exchangelabs.com; FPR:; MLV:sfv; PTR:InfoNoRecords; MX:1; LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: eroad.com X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Still looking for a bit of commentary about this one ...=20 > On 8/07/2014, at 3:43 pm, "David Morton" wrote: >=20 > Situation & background: > - Want to cater for rollback of database (9.2) migration by gracefully al= ternating master / slave roles. > - Asynchronous streaming replication is setup prior to the below migratio= n steps taking place. > - To avoid switching timelines we are purposefully not using trigger file= or pg_ctl promotion mechanisms. > - We are changing tablespace locations / symbolic links during this migra= tion so base rsync's are best avoided if possible. The dataset is also very= large so not ideal from a time perspective. > - Have performed the below in a sandbox environment and all 'appears' to = work just fine. > - WAL Archiving is used at both old and new locations but does NOT share = a common repository >=20 > Proposed migration and potential rollback steps: > 1) Prohibit connections / data change > 2) Stop master > 3) Stop slave > 4) Remove recovery.conf on slave (new master) > 5) Put in place recovery.conf on master (new slave) > 6) Start new master (old slave) > 7) Start new slave (old master) > 8) Allow connections / data change on new master here ...=20 > 9) Rollback (of database location, not data) determined to be required he= re > 10) Repeat above procedure gracefully stopping / starting and manipulatin= g recovery files >=20 > Questions: > 1) Is the above a reasonable approach to the problem in general ? > 2) Are there any risks with graceful / ordered switching of master and sl= ave roles ? > 3) If the above is not recommended ... why ? > 4) If base data MUST be synced to safely recreate slave roles .... why ? > 5) Should we force a checkpoint or pg_rotate_xlog() prior to the switchov= ers ? >=20 > General comments ? >=20 > Many thanks !! >=20 >=20 > --=20 > Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-admin --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin