Re: moving postgresql's data directory

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: moving postgresql's data directory
Дата
Msg-id 11517.1389366376@sss.pgh.pa.us
обсуждение исходный текст
Ответ на moving postgresql's data directory  (Henry Drexler <alonup8tb@gmail.com>)
Ответы Re: moving postgresql's data directory  (Henry Drexler <alonup8tb@gmail.com>)
Список pgsql-novice
Henry Drexler <alonup8tb@gmail.com> writes:
> I am just trying to move postgresql's data directory on Fedora 20,
> PostgreSQL 9.3.

> sudo systemctl stop postgresql.service
> sudo mv /var/lib/pgsql/data /home/pgdata
> sudo ln -s /home/pgdata/data  /var/lib/pgsql/
> sudo chown -R postgres:postgres /home/pgdata

That symlink doesn't sound like a terribly good idea.  You should customize
the service file to specify a correct PGDATA path, instead.  Another
thought is that it might be a good idea to alter the postgres user's
home directory setting (in /etc/passwd or wherever they keep it these
days) to be /home/pgdata.

However, I suspect that the key reason this isn't working is SELinux
restrictions.  Does it start if you "setenforce 0"?  I hasten to say
that that's a lousy permanent solution, but it would allow the theory
to be confirmed or denied quickly.  If that's it, you probably need to be
paying attention to the SELinux labeling (cf "ls -Z") of the moved
files and directories.

Also, the reason you're not finding any relevant log entries is probably
that you're not looking in the right place.  If memory serves, the Red Hat
service file starts the postmaster with log output going to
/var/lib/pgsql/postmaster.log or something like that.  The postmaster
will shortly later redirect its log output into some file under
/var/lib/pgsql/pg_log/, but startup-time failure messages might appear
in either place.

            regards, tom lane


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

Предыдущее
От: Henry Drexler
Дата:
Сообщение: moving postgresql's data directory
Следующее
От: Henry Drexler
Дата:
Сообщение: Re: moving postgresql's data directory