Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gvnGa-0007tI-Fq for pgsql-admin@arkaria.postgresql.org; Mon, 18 Feb 2019 18:03:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gvnGY-0006IB-46 for pgsql-admin@arkaria.postgresql.org; Mon, 18 Feb 2019 18:03:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gvnGX-0006I4-PP for pgsql-admin@lists.postgresql.org; Mon, 18 Feb 2019 18:03:41 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gvnGU-0004d4-Ht for pgsql-admin@postgresql.org; Mon, 18 Feb 2019 18:03:40 +0000 Received: from [192.168.127.1] (port=53705 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1gvnGR-0004WC-1b; Mon, 18 Feb 2019 18:03:35 +0000 Received: from [127.0.0.1] (port=58962 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1gvnGQ-000Ii3-BD; Mon, 18 Feb 2019 18:03:34 +0000 From: Andrew Gierth To: "S. Bob" Cc: pgsql-admin Subject: Re: Unique cluster / instance identifier? In-Reply-To: <92d53982-cf1d-ce3f-c541-60a252f85aef@quadratum-braccas.com> (S. Bob's message of "Mon, 18 Feb 2019 10:08:11 -0700") Message-ID: <87r2c5htm3.fsf@news-spur.riddles.org.uk> References: <92d53982-cf1d-ce3f-c541-60a252f85aef@quadratum-braccas.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Mon, 18 Feb 2019 18:03:34 +0000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "S" == S Bob writes: S> Hi all; S> Does PostgreSQL store a unique cluster or instance identifier that S> we can access to identify our instances? Yes. But it's not easy to get at: it's the "Database system identifier" shown in the output of pg_controldata. (pg12+ will have a function to get it from SQL, but released versions don't.) e.g. Database system identifier: 6659016342798875639 The number is mostly generated from the time the instance was created, with some bits modified. So for example: $ perl -le 'print scalar gmtime +(shift >> 32)' 6659016342798875639 Sun Feb 17 17:04:21 2019 PG uses this internally to make sure that replication never tries to apply WAL records generated on one system to a different system. Physical replication secondary systems share the primary's system identifier since they always originate as a copy (via base backup) of the primary. -- Andrew (irc:RhodiumToad)