@Dendilz

Как сделать базу Postgresql на другом диске?

Пытаюсь настроить сервер Postgresql по инструкции с сайта postgrespro
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

Выхлоп при инициализации

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

Выхлоп при запуске сервиса
root@postgres:/# 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 postgres check-db-dir[13697]: "/var/lib/pgpro/1c-10/data" is missing or empty.
Dec 21 12:37:29 postgres check-db-dir[13697]: Use "/opt/pgpro/1c-10/bin/pg-setup initdb" to initialize the da
Dec 21 12:37:29 postgres systemd[1]: postgrespro-1c-10.service: Control process exited, code=exited status=1
Dec 21 12:37:29 postgres systemd[1]: postgrespro-1c-10.service: Failed with result 'exit-code'.
Dec 21 12:37:29 postgres systemd[1]: Failed to start Postgres Pro 10 database server.

При вводе команды из лога
/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.

он всё равно пытается в папку по умолчанию залезть

на этапе инициализации, если указываю другую директорию, инициализация идёт с ошибкой, сервис не стартует, подскажите как правильно это сделать
  • Вопрос задан
  • 860 просмотров
Решения вопроса 1
/opt/pgpro/1c-10/bin/pg_ctl -D /mnt/disk1/data -l logfile start

вместо "logfile" вбить полный путь к файлу логов в директорию куда постгря может писать

если нормально запустится, написать свой юнит для systemd
Ответ написан
Пригласить эксперта
Ответы на вопрос 2
ky0
@ky0
Миллиардер, филантроп, патологический лгун
Симлинк сделайте и не забудьте права на каталог PGDATA выдать постгресу.
Ответ написан
Комментировать
ulkoart
@ulkoart
Была такая необходимость, для себя оставил 2 варианта: делать симлинк или развернуть в докере в любой удобной директории.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы