Issue: Creating Symlink for data directory of postgresql in CentOS7

From: "Chatterjee, Shibayan" <shibayan(dot)chatterjee(at)centurylink(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Issue: Creating Symlink for data directory of postgresql in CentOS7
Date: 2019-07-12 10:11:49
Message-ID: edcbd415540549e4aa36c92e7dba0a5c@level3.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I'm trying to create a symlink for 'data' directory present in '/var/lib/pgsql/', pointing to different location.
After providing exact access permissions and ownership to postgres, I'm still unable to restart postgres after modifications.

I've also modified '/var/lib/pgsql/postgresql.conf' and '/usr/lib/systemd/system/postgresql.service' to point the $PGDATA location to the actual destination as respectively:

data_directory = '/data/postgresql/data'
Environment=PGDATA=/data/postgresql/data

Can you guys help ? I tried searching a solution for this problem but still couldn't get a perfect solution.

Here's what I'm seeing in:
>>> systemctl status postgresql.service

postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2019-07-12 10:00:51 UTC; 38s ago
Process: 8852 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=1/FAILURE)
Main PID: 29483 (code=exited, status=0/SUCCESS)

Jul 12 10:00:51 systemd[1]: Starting PostgreSQL database server...
Jul 12 10:00:51 systemd[1]: postgresql.service: control process exited, code=exited status=1
Jul 12 10:00:51 systemd[1]: Failed to start PostgreSQL database server.
Jul 12 10:00:51 systemd[1]: Unit postgresql.service entered failed state.
Jul 12 10:00:51 systemd[1]: postgresql.service failed.

>>> /var/log/messages

Jul 12 10:00:51 systemd: Starting PostgreSQL database server...
Jul 12 10:00:51 postgresql-check-db-dir: "/data/postgresql/data" is missing or empty.
Jul 12 10:00:51 postgresql-check-db-dir: Use "postgresql-setup initdb" to initialize the database cluster.
Jul 12 10:00:51 postgresql-check-db-dir: See /usr/share/doc/postgresql-9.2.24/README.rpm-dist for more information.
Jul 12 10:00:51 systemd: postgresql.service: control process exited, code=exited status=1
Jul 12 10:00:51 systemd: Failed to start PostgreSQL database server.
Jul 12 10:00:51 systemd: Unit postgresql.service entered failed state.
Jul 12 10:00:51 systemd: postgresql.service failed.

-Shibayan

This communication is the property of CenturyLink and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dirk Mika 2019-07-12 11:33:23 Re: How to run a task continuously in the background
Previous Message Luca Ferrari 2019-07-12 10:04:01 help understanding pgbench results