You are not logged in.

#1 2018-09-30 12:16:07

vorlket
Member
Registered: 2017-09-30
Posts: 90

[SOLVED] Init. of postgresql database cluster to non-default loc.

Initialised to /src/data, and tried the following with hint from https://bbs.archlinux.org/viewtopic.php?id=209826.

Added the following to /etc/systemd/systen/postgresql.service.d/srvdir.conf:

[Service]
ProtectHome=false
ProtectSystem=off

and ran the following commands:

systemctl daemon-reload
systemctl enable postgresql.service
systemctl start postgresql.service

The error of not initialising to default location persists. What should I do?

Last edited by vorlket (2019-10-19 12:28:17)

Offline

#2 2018-09-30 17:45:22

loqs
Member
Registered: 2014-03-06
Posts: 17,327

Re: [SOLVED] Init. of postgresql database cluster to non-default loc.

Why would

ProtectHome=true
ProtectSystem=full

affect /src/data ?

What is the actual output from the journal?  How did you initialize the database? (please include commands and outputs)

Offline

#3 2018-10-01 01:46:05

vorlket
Member
Registered: 2017-09-30
Posts: 90

Re: [SOLVED] Init. of postgresql database cluster to non-default loc.

Initialised database as follows:

[postgres]$ initdb -D '/srv/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 "C".
The default database encoding has accordingly been set to "SQL_ASCII".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /srv/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D /srv/data -l logfile start

Output from the journal is

$ cat journalctl | less
-- Logs begin at Sun 2018-09-30 00:40:57 UTC, end at Mon 2018-10-01 01:20:36 UTC. --
Oct 01 01:19:00 cliffnohserver kernel: ... version:                3
...
-- Unit postgresql.service has begun starting up.
Oct 01 01:42:21 cliffnohserver postgres[32408]: "/var/lib/postgres/data" is missing or empty. Use a command like
Oct 01 01:42:21 cliffnohserver postgres[32408]:   su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/postgres/data'"
Oct 01 01:42:21 cliffnohserver postgres[32408]: with relevant options, to initialize the database cluster.
Oct 01 01:42:21 cliffnohserver systemd[1]: postgresql.service: Control process exited, code=exited status=1
Oct 01 01:42:21 cliffnohserver systemd[1]: postgresql.service: Failed with result 'exit-code'.
Oct 01 01:42:21 cliffnohserver systemd[1]: Failed to start PostgreSQL database server.
-- Subject: Unit postgresql.service has failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit postgresql.service has failed.
--
-- The result is RESULT.
Oct 01 01:42:21 cliffnohserver audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=postgresql comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
Oct 01 01:42:21 cliffnohserver kernel: audit: type=1130 audit(1538358141.173:85): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=postgresql comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'

Offline

#4 2018-10-01 04:36:12

vorlket
Member
Registered: 2017-09-30
Posts: 90

Re: [SOLVED] Init. of postgresql database cluster to non-default loc.

https://wiki.archlinux.org/index.php/Po … _directory solved.

Another database cluster is initialised with creation of another postgresql.service.

Last edited by vorlket (2018-10-01 05:24:20)

Offline

Board footer

Powered by FluxBB