D
D
Dendilz2018-12-24 16:58:10
PostgreSQL
Dendilz, 2018-12-24 16:58:10

How to make a Postgresql database on a different drive?

I'm trying to set up a Postgresql server following instructions from the postgrespro site
apt-get update -y
apt-get install -y wget gnupg2 || apt-get install -y gnupg
wget -O - repo.postgrespro.ru/keys/GPG-KEY-POSTGRESPRO | apt-key add -
echo deb repo.postgrespro.ru/1c-archive/pg1c-10.5/ubuntu bionic main > /etc/apt/sources.list.d/postgrespro-1c.list
apt-get update -y
apt-get install -y postgrespro-1c-10-server postgrespro-1c-10-contrib
/opt/pgpro/1c-10/bin/pg-setup initdb -D /mnt/disk1/data
service postgrespro-1c-10 start
Exhaust on initialization
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 enabled.
creating directory /mnt/disk1/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
Success. You can now start the database server using:
/opt/pgpro/1c-10/bin/pg_ctl -D /mnt/disk1/data -l logfile start
Exhaust when starting service
[email protected]: /# systemctl status postgrespro-1c-10 .service
● postgrespro-1c-10.service - Postgres Pro 10 database server
Loaded: loaded (/lib/systemd/system/postgrespro-1c-10.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2018-12-21 12:37:29 UTC; 9min ago
Process: 13697 ExecStartPre=/opt/pgpro/1c-10/bin/check-db-dir ${PGDATA} (code=exited, status=1/FAILURE)
Dec 21 12:37:29 postgres systemd[1] : Starting Postgres Pro 10 database server...
Dec 21 12:37:29 pm postgres check-db-dir[13697]: "/var/lib/pgpro/1c-10/data" is missing or empty.
Dec 21 12:37:29 pm postgres check-db-dir[13697]: Use "/opt/pgpro/1c-10/bin/pg-setup initdb" to initialize the da
Dec 21 12:37:29 pm postgres systemd[1 ]: postgrespro-1c-10.service: Control process exited, code=exited status=1
Dec 21 12:37:29 pm postgres systemd[1]: postgrespro-1c-10.service: Failed with result 'exit-code'.
Dec 21 12:37:29 pm postgres systemd[1]: Failed to start Postgres Pro 10 database server.
When entering a command from the log
/opt/pgpro/1c-10/bin/pg_ctl -D /mnt/disk1/data -l logfile start
waiting for server to start..../bin/sh: 1: cannot create logfile: Permission denied
stopped waiting
pg_ctl: could not start server
Examine the log output.
it still tries to get
into the default folder at the initialization stage, if I specify another directory, the initialization goes with an error, the service does not start, tell me how to do it right

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir, 2018-12-25
@Dendilz

/opt/pgpro/1c-10/bin/pg_ctl -D /mnt/disk1/data -l logfile start

instead of "logfile" drive the full path to the log file into the directory where postgre can write
if it starts normally, write your unit for systemd

K
ky0, 2018-12-24
@ky0

Make a symlink and don't forget to PGDATAgrant permissions to the directory to postgres.

A
Artem, 2018-12-25
@ulkoart

There was such a need, I left 2 options for myself: make a symlink or deploy it in the docker in any convenient directory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question