Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fMdha-0005Ix-8i for pgsql-general@arkaria.postgresql.org; Sat, 26 May 2018 18:14:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fMdhY-0001Ho-OV for pgsql-general@arkaria.postgresql.org; Sat, 26 May 2018 18:14:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fMdhY-0001He-DE for pgsql-general@lists.postgresql.org; Sat, 26 May 2018 18:14:00 +0000 Received: from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fMdhR-0004Fg-5L for pgsql-general@postgresql.org; Sat, 26 May 2018 18:13:59 +0000 Received: by mail-qk0-x241.google.com with SMTP id 185-v6so6470385qkk.11 for ; Sat, 26 May 2018 11:13:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=K0LVgBiMzn1JVthyspkf0gJjQMpfCi/mni/U9T+uhj0=; b=de/A/tAoS+AQmZKLDi2bI2tuh0kN1equnb0Bc0B9WwFZqW5W00bZx5KGoKOSPimK7W YaW2UX/9zgU5w6QVTSMyh5DpodMZ4C7AliTe/czS39fxPcdoGpxJDyHjVoJSE+ityJ0X JQbtFLAGXtmNGluJrPsK5v8u00k1eHKVb7MdSmp9JLIgMTeo7HFSNW4BT5yRsbb5bFCs AYGfQS/jiKmOZ8WsjeCzQalw0krC8iakE/Z2qrdaDdpm7fUtCaXa4OO3wsxIZJgdpMFG LJ/6jnn3rdo1sqk2IsmNWha3+Kgz8iRjURa6qbxsyJp2kZBRLRRPCOfEjXV3PfR7WcVu irYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=K0LVgBiMzn1JVthyspkf0gJjQMpfCi/mni/U9T+uhj0=; b=I2G8y4oHG8SiCEoY2vhVdMhxkaSuVV7oVQwwBWmfkhqGMFFlHVSDOKxJ2BG15YPKfW Oxzi+WjNDheFHJyDGJ8aZXzW530zDM1UI9H7Ah1RRy1CxfxSlVFrnqB2S2+bejmBBXsi ChB5iK+Tf3xgnDS9LzHBy4uX4Grss4/HRnGxg0hn9QjY1nwK9ABFlovT/CZ7pTLycskl ubHG/WGamHBXQU2es2KAncDgF6q5HIyFa/9oSyie6r84XIJpXgGz+HTd/tepjmjdx/Lw mNi+SW94odtHw0oHV8GayxkA1AsAeAG9MRp7pG+5KuQiRkRu5hFuxmWAYrgDJs1A0BY1 OiNA== X-Gm-Message-State: ALKqPwdTd1X7nBWFvKdqiTu/kOp3QU221IgtEV78ggRnOzeN+uN67P+4 rWgNh6Njhq68JqT2enF5Qt2ACjn4D+WOIOUqPDff6urJYi41KRtN7Pu2FCg59Gt9fPxUHE704Jk XNEvoq2eRnTEYMr2Db8gym9j+9ArYKOMmWL94wOJuttpZ5rOwdpXU/XJvuwsJzDRyJrh78C6txG UGZ5S8Jc+Lb2ZlAA== X-Google-Smtp-Source: ADUXVKIqUU3OkmzvvWWSqTl1HG8YGFx5OGNPBiH0O2e9MRrp2NwI3VWj2aTQI58Neh8nPrg+QLilIA== X-Received: by 2002:a37:5ac5:: with SMTP id o188-v6mr6173382qkb.295.1527358430856; Sat, 26 May 2018 11:13:50 -0700 (PDT) Received: from alderaan.marques (host210.186-108-167.telecom.net.ar. [186.108.167.210]) by smtp.googlemail.com with ESMTPSA id m8-v6sm18171679qth.24.2018.05.26.11.13.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 May 2018 11:13:50 -0700 (PDT) Subject: Re: Fast logical replication jump start with PG 10 To: Adrian Klaver , Olivier Gautherot Cc: pgsql-general@postgresql.org References: <729c1726-2e61-f03f-fe7e-c1dcf3f59e85@aklaver.com> <239dddd5-aa45-a7fe-b35a-085b978f8bd6@aklaver.com> <67e76903-b1fb-5a43-4b83-4f721ae2e1b0@aklaver.com> From: =?UTF-8?Q?Mart=c3=adn_Marqu=c3=a9s?= Message-ID: <37f124de-5346-263a-01b9-f593673a3c43@2ndquadrant.com> Date: Sat, 26 May 2018 15:13:45 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <67e76903-b1fb-5a43-4b83-4f721ae2e1b0@aklaver.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, El 26/05/18 a las 14:27, Adrian Klaver escribió: > > I am still learning what logical replication is capable of so take the > following with that in mind. > > 1) I used > pg_basebackup(www.postgresql.org/docs/10/static/app-pgbasebackup.html) > to create a new $DATA directory for a replica instance. > > 2) I configured the master and the replica for logical replication. Also > changed the copied over conf files to work for the new instance e.g. > changed the port number. > > 3) I set up the PUBLICATION: > > CREATE PUBLICATION everything FOR ALL TABLES; > > 4) I set up the SUBSCRIPTION: > > CREATE SUBSCRIPTION test_sub CONNECTION 'dbname=production user=postgres > port=5432' PUBLICATION everything WITH(copy_data=false); > > *NOTE* the copy_data=false. > > 5) Then I started entering data in the master and it was replicated. > > Caveats: > > 1) This was a small database. > > 2) The master and replica where on the same machine. > > 3) There was no activity on the master between the pg_basebackup and the > CREATE PUBLICATION/CREATE SUBSCRIPTION commands. This last caveat is a stopper. If the active node is *active* (receiving writes statements) you'll lose all those changes. I would instead suggest using pglogical and the pglogical_create_subscriber tool to create the subscriber from a basebackup. Kind Regards, -- Martín Marqués http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services