Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oqoXA-0007Uu-A5 for pgsql-general@arkaria.postgresql.org; Fri, 04 Nov 2022 04:42:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oqoX9-0007As-5N for pgsql-general@arkaria.postgresql.org; Fri, 04 Nov 2022 04:42:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oqoX7-0007AW-Cf for pgsql-general@lists.postgresql.org; Fri, 04 Nov 2022 04:42:22 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oqoX2-0005tp-SO for pgsql-general@lists.postgresql.org; Fri, 04 Nov 2022 04:42:21 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 2EFA632007E8; Fri, 4 Nov 2022 00:42:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 00:42:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1667536931; x= 1667623331; bh=AtJiC1elIFnZA90INRvYjw5Pcz+mwRnJai6wFuPs3Ss=; b=m dd4ZGqvx2J9wU4Odk031VD73qw5sDzWKEjclymhP6gwqUseI2alXTOAJKs8c0HSp ooq5kSkb1j4wTkQyZjmyoFmm+5vzrBzNJGKiauKM0mnx9efvw6MvQL7FzJg93diy KEPNBS69VIwH4CKJEhUr+Lk6gSJdAa6UNatQyPdUp+6xazesx6Y3npX/swoi5J41 xn2Qiczpp6LtrC8LULNhq/qcJrEaoG+YrFtocoKylF8/T3iIkq9dEcZW75aYzciF QbdgIwUav3EosB4rpoYT/0Il5Y1VDKVRuRdMo5AY4r3TLxGaHxpkD8eoU9AlQfTR CgthsOJX3QSpSbsjPxvDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667536931; x= 1667623331; bh=AtJiC1elIFnZA90INRvYjw5Pcz+mwRnJai6wFuPs3Ss=; b=d l4prQDfcHLmtRSvL2zMr0kXAYOBTqfbTr5Z5H1opPnQ9XA4Y9QPYVQaYX318hYcB 1qsDxjh64F1aliAAfrX9q8nw5DFOPmpEUbTGDwbDW/D5baUXubeUMvudY+jM3Y7u tEPZemd4iz8BJIcCZ3gJVWX9443KSp2itj3HTXv+o/yW1/otWAPAxOZBMG5aLSq0 pbfMP076zfsWroY0HxT96F1S58cJXi80bhYxKpnd7dqwM745ue8s6f9BXfQD1PAf dciL3xnRdG06oFwozDw5o3MyzXp7J0WEPrhBoUawW4vob2yFW1hdhLgIuAmUr6Aj nqwnQPmCEFd70mNEtGosQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddtgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpefhgeevkeefleffvdfgvdefffdtueejheehueeifffh feeihfdvhffgtefgvdeugfenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhi rghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 00:42:10 -0400 (EDT) Message-ID: Date: Thu, 3 Nov 2022 21:42:10 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: Putting the O/S user for "local" "peer" authentication in the "postgres" group vs chmod'ing the "pg*.conf" files to be readable by "all" Content-Language: en-US To: Bryn Llewellyn Cc: "David G. Johnston" , pgsql-general list , "Peter J. Holzer" , laurenz.albe@cybertec.at, Karsten Hilbert References: <5EDD4790-7982-4610-8371-9E7F9C7F960B@yugabyte.com> <4B667995-647F-48BB-94CC-22ADE19F0BFB@yugabyte.com> <3A027257-8C6C-444D-91CB-37D53CC0C817@yugabyte.com> <2e36cc43-a759-34f8-8179-72ade14ef72e@aklaver.com> <0FB2CA70-B125-4675-9871-562A6EFDE3DB@yugabyte.com> <55260909-8740-1fc0-68a9-4656ac8e755d@aklaver.com> <1F0DC0E4-EF4B-4815-BB30-93449B9AA9FF@yugabyte.com> From: Adrian Klaver In-Reply-To: <1F0DC0E4-EF4B-4815-BB30-93449B9AA9FF@yugabyte.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/3/22 18:50, Bryn Llewellyn wrote: >> adrian.klaver@aklaver.com wrote: > >> It isn't you where using pg_ctl and in the Debian/Ubuntu packaging the >> better option for that is pg_ctlcluster. I generally use the systemd >> scripts to start/stop Postgres instances, though when I do >> pg_lsclusters I tend to fall into using pg_ctlcluster as the cluster >> info is right there. > > Can't parse this. Sorry. Short version, use what works for you. > Fair enough. I started again from the state where my "config_file", my > "hba_file", and my "ident_file" are all customized as I want them to be > but where I hadn't yet tried to trash my cluster and re-create it. Then > I tried with "pg_dropcluster --stop" and "pg_createcluster". I > discovered immediately that this approach (in contrast to the "initdb" initdb will not work on an directory with existing files, so this: sudo -u postgres initdb \ -U postgres --encoding UTF8 --locale=C --lc-collate=C --lc-ctype=en_US.UTF-8 \ -A md5 --pwfile=my_password_file \ -D /var/lib/postgresql/11/main Will only work if /var/lib/postgresql/11/main is empty, so none of your customized files will be there. You will have to copy them in just as you do below. As example: postgres@maura:/usr/local/pgsql15> bin/initdb -D data/ The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.UTF-8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled. initdb: error: directory "data" exists but is not empty initdb: hint: If you want to create a new database system, either remove or empty the directory "data" or run initdb with an argument other than "data". FYI, you might want to take a look at the the includes mechanism: https://www.postgresql.org/docs/15/config-setting.html#CONFIG-SETTING-CONFIGURATION-FILE > approach) blows away all the *.conf files and recreates them in > canonical form—just as the "man" page says. This is a bit of a nuisance. > But it's negotiable. I installed my files as I want them in a safe > place, outside of the entire PG world, and then used this script: > sudo pg_dropcluster --stop 11 main sudo pg_createcluster 11 main \ -e UTF8 --locale=C --lc-collate=C --lc-ctype=en_US.UTF-8 \ -d /var/lib/postgresql/11/main \ > /dev/null sudo cp /etc/ybmt-code/pg-and-yb-config-files/*.conf \ /etc/postgresql/11/main sudo chown postgres /etc/postgresql/11/main/*.conf sudo chgrp postgres /etc/postgresql/11/main/*.conf sudo chmod 644 /etc/postgresql/11/main/*.conf sudo chmod 640 /etc/postgresql/11/main/pg_hba.conf sudo chmod 640 /etc/postgresql/11/main/pg_ident.conf sudo pg_ctlcluster start 11/main sudo -u postgres psql -c " select name, setting from pg_settings where category = 'File Locations'; " sudo -u postgres psql -f /etc/ybmt-code/cluster-mgmt/01-initialize-brand-new-YB-or-PG-clstr/00.sql > It worked without error and had the intended effect. My old approach > with the uncommitted chicken used to take ~3 sec. This new approach > takes ~5 sec. The difference is completely unimportant. > > For various reasons, I need the non-standard "--lc-collate=C" choice. I > could doubtless leave all the other options unspecified. But that's the > style discussion we had the other day—and I prefer, here, to self-doc my > choices. > > I discovered that using, say, the "initdb" approach, then the "kosher" > approach, and then the "initdb" approach brought all sorts of errors. > That's the beauty of using a VM and file backups (or snapshots). I > suppose this is to be expected. Hence commitment instead of involvement. > > *Can I declare victory, now, with the approach that I showed above?* You are setting the goals not us, that is your decision. > p.s. Is my pessimism justified—that there simply exists no plain English > user guide for this whole Debian/Ubuntu apparatus—correct. Or is it, > rather, that my search skills are just too feeble? Not that I know of. -- Adrian Klaver adrian.klaver@aklaver.com