Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 18E421337BB4 for ; Mon, 11 Apr 2011 12:56:34 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 36259-05 for ; Mon, 11 Apr 2011 15:56:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f46.google.com (mail-ew0-f46.google.com [209.85.215.46]) by mail.postgresql.org (Postfix) with ESMTP id 852CB1337B97 for ; Mon, 11 Apr 2011 12:56:26 -0300 (ADT) Received: by ewy4 with SMTP id 4so1756502ewy.19 for ; Mon, 11 Apr 2011 08:56:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=H+j+rJdyWjo8tMDGCLRO7cRyl8ZH8Okxo/StulJ/9Ck=; b=YAzaWJzP2189m+jwZzrM22T2MkTMkTQ3fdgDbPam/pVwd/YZFuM+umHqnzNd3dXQzQ 6NiqJseue4qos+YkPHP8+vXpFMQRyl1QIcGf0ki8GklSWsE4mHMv70df5/07JM4+gSax M6Rk55Xm6XFG4Y3639jl3FacrBEfz66ZHN1sI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=xId28aryrpXzJC/ggqHI0IA8z/z0BsJHw5tHgsYfeCAykkMOp1ZvGHcdSJtKIlh/qJ 3skLpjqrf4AZRM870Mh+Ov+PixMI3zWYt4n5Ur/nRqkQch8cls7s5e31M8dvW0I+c8zj k1w4KH4zzp4l+cQHmKF+eW4lq9hscNqml3k0I= MIME-Version: 1.0 Received: by 10.213.28.10 with SMTP id k10mr2339958ebc.24.1302537383977; Mon, 11 Apr 2011 08:56:23 -0700 (PDT) Received: by 10.213.13.139 with HTTP; Mon, 11 Apr 2011 08:56:23 -0700 (PDT) In-Reply-To: References: Date: Mon, 11 Apr 2011 17:56:23 +0200 Message-ID: Subject: Re: multiple hot standby streaming replication scenario with "rotating" the primary server From: Gerhard Hintermayer To: pgsql-admin Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.42 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, FS_REPLICA=3.599, SARE_SPEC_REPLICA=0.72 X-Spam-Level: ** X-Archive-Number: 201104/84 X-Sequence-Number: 37265 On Thu, Apr 7, 2011 at 11:40 AM, Gerhard Hintermayer wrote: > Hi, > I'm trying to set up at least 3 servers using hot standby streaming > replication. I'd like to have one primary and 2 secondary (on 2 > different locations in case of a desaster in the server room). > A primary > B secondary 1 > C secondary 2 (on a different location that A and B) > > Are the following actions in case of recovering to any of the standby > servers (B or C) correct ? > > 1. primary A crashes/maintenance or whatever > 2. creating the trigger file on B brings this server to life. > 3. stop server on C > 4. make base backup on B and install it on C and A (if already available) > 5. change primary_conninfo in recovery.conf on A,C to reflect new primary B > 6. start server on A,C > I managed to change 4. to use rsync, which is really faster that zip/transfer/extract, even though index files have a large impact on the transfered data volume. (my db is ~ 7GB on disk, and even though I made minimal changes, approx 2.5 GB of data is transfered when making a new base backup with rsyncing over the existing data dir. tI roughly takes 10 min to rsync (over 100Mbit LAN). Unfortunately I had to insert 2.1 reindex database [for all databases] after creating the trigger file on the new dedicated primary, which takes another 10-20 minutes to make any queries to the DB working (since I heavyly depend on indices. So I have ~ 30 mins to get my new primary up and ready for production :-( Is there anything how I can speedup things. I know that I have some large tables, where mos't of the reindex time is, spent, so reindex these few tables later would be an option, but that special treatment has to be maintained for new tables, so I'd prefer a more generic way. regards Gerhard