Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XPQ8o-00037E-N4 for pgsql-docs@arkaria.postgresql.org; Thu, 04 Sep 2014 06:03:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XPQ8o-000425-6L for pgsql-docs@arkaria.postgresql.org; Thu, 04 Sep 2014 06:03:30 +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 1XPQ8n-00041r-BB for pgsql-docs@postgreSQL.org; Thu, 04 Sep 2014 06:03:29 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XPQ8j-0003NB-HH for pgsql-docs@postgreSQL.org; Thu, 04 Sep 2014 06:03:28 +0000 Received: from intern.anarazel.de (static-243-200-78-212.thenetworkfactory.nl [212.78.200.243]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id C89FB4F0001; Thu, 4 Sep 2014 08:03:18 +0200 (CEST) Date: Thu, 4 Sep 2014 08:03:18 +0200 From: Andres Freund To: Josh Berkus Cc: pgsql-docs@postgreSQL.org Subject: Re: Missing docs: setting up replication slots for standbys Message-ID: <20140904060318.GD3625@alap3.anarazel.de> References: <5407FBF7.5070204@agliodbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5407FBF7.5070204@agliodbs.com> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org On 2014-09-03 22:43:19 -0700, Josh Berkus wrote: > > Section 46.2.2 has this: > > Note: PostgreSQL also has streaming replication slots (see Section > 25.2.5), but they are used somewhat differently there. > > Section 25.2.5 has this: > > You can avoid this by setting wal_keep_segments to a value large enough > to ensure that WAL segments are not recycled too early, or by > configuring a replication slot for the standby. > > ... however, absolutely nowhere is it explained how to configure a > replication slot for a streaming replica. Is it, in fact, possible to > do so? It actually is explained. I don't have a built source handy right now, so chapter numbers... But at least the following is there: Configuration Example You can create a replication slot like this: postgres=# SELECT * FROM pg_create_physical_replication_slot('node_a_slot'); slot_name | xlog_position -------------+--------------- node_a_slot | postgres=# SELECT * FROM pg_replication_slots; slot_name | slot_type | datoid | database | active | xmin | restart_lsn -------------+-----------+--------+----------+--------+------+------------- node_a_slot | physical | | | f | | (1 row) To configure the standby to use this slot, primary_slot_name should be configured in the standby's recovery.conf. Here is a simple example: standby_mode = 'on' primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass' primary_slot_name = 'node_a_slot' and I'm pretty sure primary_slot_name and such is configured at the appropriate place too. That's not to say it can't be be expanded and/or better linked... Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs