RE: [EXT] Re: BUG #17469: postgresql-11.service file not configured to match setup/initdb options specified

Поиск
Список
Период
Сортировка
От Joe Hebert (jhebert)
Тема RE: [EXT] Re: BUG #17469: postgresql-11.service file not configured to match setup/initdb options specified
Дата
Msg-id SN4PR0801MB7935B3791EF5A14F7E4EDDC6C7FC9@SN4PR0801MB7935.namprd08.prod.outlook.com
обсуждение исходный текст
Ответ на Re: BUG #17469: postgresql-11.service file not configured to match setup/initdb options specified  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs

Micron Confidential

 

Hi David,

 

Thanks for your response.  Initially I was attempting to use sudo to initialize the DB per the sample commands provided at the following web page:

 

https://www.postgresql.org/download/linux/redhat/

 

From the recommended script on that page:

# Optionally initialize the database and enable automatic start:

sudo /usr/pgsql-11/bin/postgresql-11-setup initdb

sudo systemctl enable postgresql-11

 

Due to encountering error “failed to find PGDATA setting in /postgres/data/datafiles.service”, it looked like I had encountered bug #15108, which led me to use initdb instead of postgresql-11-setup per Sergei’s recommendation.  Below are the actual commands I used, which were successful:

 

/usr/pgsql-11/bin/initdb -A ldap -E utf8 -D /postgres/data/datafiles -X /postgres/tranlog

sudo systemctl enable postgresql-11

 

Anyway, since the above recommended commands were to be run with sudo, I presumed the systemctl template for postgresql would have been generated with the -D option value I provided embedded in the PGDATA environment variable in the template (/usr/lib/systemd/system/postgresql-11.service).  However, after realizing that I could not use sudo with initdb, it makes sense that it would not integrate with the postgresql-11.service template.

 

I guess I am not sure where that template file comes from (and which process generates it), but it would be nice if we didn’t have to edit the template every time we install.  On my side, finding a way to edit the file (sudo systemctl edit --full postgresql-11) in an automated way (for unattended installs) may be problematic.

 

Hopefully this helps explain the path I took and my thought process.

 

Joe

 

 

 

Micron Confidential

From: David G. Johnston <david.g.johnston@gmail.com>
Sent: Thursday, April 28, 2022 5:58 PM
To: Joe Hebert (jhebert) <jhebert@micron.com>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: [EXT] Re: BUG #17469: postgresql-11.service file not configured to match setup/initdb options specified

 

CAUTION: EXTERNAL EMAIL. Do not click links or open attachments unless you recognize the sender and were expecting this message.

 

On Thu, Apr 28, 2022 at 4:42 PM PG Bug reporting form <noreply@postgresql.org> wrote:

The following bug has been logged on the website:

Bug reference:      17469
Logged by:          Joe Hebert
Email address:      jhebert@micron.com
PostgreSQL version: 11.11
Operating system:   RHEL 8.5
Description:       

After researching further, I reviewed file
/usr/lib/systemd/system/postgresql-11.service
and found the following offending line:
Environment=PGDATA=/var/lib/pgsql/11/data/

Which should have been set to /postgres/data/datafiles based in the option
provided to the initdb command.

 

I'm curious to know where you got the idea that initdb integrated with systemd.  I'm under the impression it doesn't.  PostgreSQL core doesn't generally deal with such platform-specific concerns (i.e., it isn't a feature enhancement we would consider).

 

If you go against the conventions of your packaged distribution (or do not avail yourself of its tooling) you have to do the customizations yourself.

 

David J.

 

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: BUG #17472: Jsonb[] operations not working
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17473: Custom range type with timestamp doesn't respect precision