Re: BUG #16204: Fail to setup

From: 小林 巧 <chamaharun(at)outlook(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16204: Fail to setup
Date: 2020-01-13 09:50:14
Message-ID: TYAPR01MB38852D852A730811ED8DC796DA350@TYAPR01MB3885.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thanks.

>The Postgres project as such doesn't distribute systemd
>service scripts, so you'll need to take this up with
>whoever created the script you're using.

Before I install postgresql-10 server, it is no systemd unit file:

[root(at)tkw-pgcl-sv003 ~]# ls -l /lib/systemd/system/posttgres*
ls: /lib/systemd/system/postgres* にアクセスできません: そのようなファイルやディレクトリはありません

But after install it be created:

[root(at)tkw-pgcl-sv003 ~]# ls -l /lib/systemd/system/postgres*
-rw-r--r--. 1 root root 1728 11月 30 23:29 /lib/systemd/system/postgresql-10.service

[root(at)tkw-pgcl-sv003 ~]# cat /lib/systemd/system/postgresql-10.service
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to create a file "/etc/systemd/system/postgresql-10.service",
# containing
# .include /usr/lib/systemd/system/postgresql-10.service
# ...make your changes here...
# For more info about custom unit files, see
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

# Note: changing PGDATA will typically require adjusting SELinux
# configuration as well.

# Note: do not use a PGDATA pathname containing spaces, or you will
# break postgresql-setup.
[Unit]
Description=PostgreSQL 10 database server
Documentation=https://www.postgresql.org/docs/10/static/
After=syslog.target
After=network.target

[Service]
Type=notify

User=postgres
Group=postgres

# Note: avoid inserting whitespace in these Environment= lines, or you may
# break postgresql-setup.

# Location of database directory
Environment=PGDATA=/var/lib/pgsql/10/data/

# Where to send early-startup messages from the server (before the logging
# options of postgresql.conf take effect)
# This is normally controlled by the global default set by systemd
# StandardOutput=syslog

# Disable OOM kill on the postmaster
OOMScoreAdjust=-1000
Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
Environment=PG_OOM_ADJUST_VALUE=0

ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA}
ExecStart=/usr/pgsql-10/bin/postmaster -D ${PGDATA}
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT

# Do not set any timeout value, so that systemd will not kill postmaster
# during crash recovery.
TimeoutSec=0

[Install]
WantedBy=multi-user.target

The systemd unit file seems to derive from the rpm package the official site distributes.
So where should I contact to solve this issue?

I installed postgresql-10 server from the repository from official website:
https://yum.postgresql.org/repopackages.php

And installed commands are:

# yum -y install https://downloareporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# yum -y install postgresql10-server postgresql10-contrib
# mkdir /mnt/postgres
# mkdir /mnt/postgres/data
# chown postgres:postgres /mnt/postgres/data

Best regards, Takumi Kobayashi
________________________________
差出人: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
送信日時: 2020年1月13日 1:55
宛先: 小林 巧 <chamaharun(at)outlook(dot)com>
CC: pgsql-bugs(at)lists(dot)postgresql(dot)org <pgsql-bugs(at)lists(dot)postgresql(dot)org>
件名: Re: BUG #16204: Fail to setup

=?iso-2022-jp?B?GyRCPi5OUxsoQiAbJEI5KhsoQg==?= <chamaharun(at)outlook(dot)com> writes:
> [root(at)tkw-pgcl-sv004 ~]# cat /var/lib/pgsql/10/initdb.log
> ...
> fixing permissions on existing directory /mnt/postgres/data ... ok
> ...
> Success. You can now start the database server using:
> /usr/pgsql-10/bin/pg_ctl -D /mnt/postgres/data -l logfile start

Right. So, clearly, initdb thinks it was told to initialize
/mnt/postgres/data. Looking back at your original trace,
we see it being called like this:

+ runuser -l postgres -c '/usr/pgsql-10/bin/initdb
--pgdata='\''/var/lib/pgsql/10/data/'\'' --auth='\''ident'\''
--data-checksums -E utf8 --no-locale -D /mnt/postgres/data'
^^^^^^^^^^^^^^^^^^^^^

So evidently that won out over the earlier --pgdata switch,
which is unsurprising. But it definitely looks like this
service script is confused, or else you've put a -D switch
into some option that's not supposed to contain that.

The Postgres project as such doesn't distribute systemd
service scripts, so you'll need to take this up with
whoever created the script you're using.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message IT (Pravin Annasaheb Kade) 2020-01-13 13:02:40 PostGreSQL Client - Windows 10 Compatibility
Previous Message Sandeep Thakkar 2020-01-13 04:51:51 Re: postgresql mac operation issue 10.11