PostgreSql Service different path

Started by chris navarrozaover 3 years ago5 messagesgeneral
Jump to latest
#1chris navarroza
canavarroza.work@gmail.com

Hi,

I install postgresql14.5 with the following commands

sudo yum install postgresql14-server postgresql14-contrib

sudo su postgres

cd /tmp

/usr/pgsql-14/bin/initdb -D /home/dmartuser/pgsql/14/data
and update the postgresql.conf to the new path, now when I start the
service, it has an error and when I check it says

-- Unit postgresql-14.service has begun starting up.
Oct 24 15:16:45 datamartds postgresql-14-check-db-dir[132338]:
*"/var/lib/pgsql/14/data/"
is missing or empty.*
Oct 24 15:16:45 datamartds postgresql-14-check-db-dir[132338]: Use
"/usr/pgsql-14/bin/postgresql-14-setup initdb" to initialize the database
cluster.
Oct 24 15:16:45 datamartds postgresql-14-check-db-dir[132338]: See
/usr/share/doc/postgresql14/README.rpm-dist for more information.
Oct 24 15:16:45 datamartds systemd[1]: postgresql-14.service: Control
process exited, code=exited status=1
Oct 24 15:16:45 datamartds systemd[1]: postgresql-14.service: Failed with
result 'exit-code'.

How can I point the service to read the new path (
/home/dmartuser/pgsql/14/data )?

Thanks,

Chris Albert Navarroza
Information Technology Officer I
CTCO - ITDS - RDMD

#2Jeffrey Walton
noloader@gmail.com
In reply to: chris navarroza (#1)
Re: PostgreSql Service different path

On Mon, Oct 24, 2022 at 6:38 AM chris navarroza
<canavarroza.work@gmail.com> wrote:

I install postgresql14.5 with the following commands

sudo yum install postgresql14-server postgresql14-contrib

sudo su postgres

cd /tmp

/usr/pgsql-14/bin/initdb -D /home/dmartuser/pgsql/14/data

and update the postgresql.conf to the new path, now when I start the service, it has an error and when I check it says

-- Unit postgresql-14.service has begun starting up.
Oct 24 15:16:45 datamartds postgresql-14-check-db-dir[132338]: "/var/lib/pgsql/14/data/" is missing or empty.
Oct 24 15:16:45 datamartds postgresql-14-check-db-dir[132338]: Use "/usr/pgsql-14/bin/postgresql-14-setup initdb" to initialize the database cluster.
Oct 24 15:16:45 datamartds postgresql-14-check-db-dir[132338]: See /usr/share/doc/postgresql14/README.rpm-dist for more information.
Oct 24 15:16:45 datamartds systemd[1]: postgresql-14.service: Control process exited, code=exited status=1
Oct 24 15:16:45 datamartds systemd[1]: postgresql-14.service: Failed with result 'exit-code'.

How can I point the service to read the new path ( /home/dmartuser/pgsql/14/data )?

The startup script that is calling systemd should perform a `mkdir -p
/var/lib/pgsql/14/data` before calling the PostgreSQL binary.

Jeff

#3chris navarroza
canavarroza.work@gmail.com
In reply to: Jeffrey Walton (#2)
Re: PostgreSql Service different path

But I'm using a different path when I initdb /usr/pgsql-14/bin/initdb
-D */home/dmartuser/pgsql/14/data
*so "/var/lib/pgsql/14/data/" is really empty. Is there a way to point the
startup script to the new path */home/dmartuser/pgsql/14/data* ?

Thanks,

Chris Albert Navarroza
Information Technology Officer I
CTCO - ITDS - RDMD

On Mon, Oct 24, 2022 at 6:57 PM Jeffrey Walton <noloader@gmail.com> wrote:

Show quoted text

On Mon, Oct 24, 2022 at 6:38 AM chris navarroza
<canavarroza.work@gmail.com> wrote:

I install postgresql14.5 with the following commands

sudo yum install postgresql14-server postgresql14-contrib

sudo su postgres

cd /tmp

/usr/pgsql-14/bin/initdb -D /home/dmartuser/pgsql/14/data

and update the postgresql.conf to the new path, now when I start the

service, it has an error and when I check it says

-- Unit postgresql-14.service has begun starting up.
Oct 24 15:16:45 datamartds postgresql-14-check-db-dir[132338]:

"/var/lib/pgsql/14/data/" is missing or empty.

Oct 24 15:16:45 datamartds postgresql-14-check-db-dir[132338]: Use

"/usr/pgsql-14/bin/postgresql-14-setup initdb" to initialize the database
cluster.

Oct 24 15:16:45 datamartds postgresql-14-check-db-dir[132338]: See

/usr/share/doc/postgresql14/README.rpm-dist for more information.

Oct 24 15:16:45 datamartds systemd[1]: postgresql-14.service: Control

process exited, code=exited status=1

Oct 24 15:16:45 datamartds systemd[1]: postgresql-14.service: Failed

with result 'exit-code'.

How can I point the service to read the new path (

/home/dmartuser/pgsql/14/data )?

The startup script that is calling systemd should perform a `mkdir -p
/var/lib/pgsql/14/data` before calling the PostgreSQL binary.

Jeff

#4Peter J. Holzer
hjp-pgsql@hjp.at
In reply to: chris navarroza (#1)
Re: PostgreSql Service different path

On 2022-10-24 15:51:30 +0800, chris navarroza wrote:

sudo yum install postgresql14-server postgresql14-contrib

[...]

/usr/pgsql-14/bin/initdb -D /home/dmartuser/pgsql/14/data

and update the postgresql.conf to the new path, now when I start the service,
it has an error and when I check it says 

[doesn't use /home/dmartuser/pgsql/14/data]

How can I point the service to read the new path ( /home/dmartuser/pgsql/14/
data )? 

Check the systemd configuration file for this service.

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

#5chris navarroza
canavarroza.work@gmail.com
In reply to: chris navarroza (#3)
Re: PostgreSql Service different path

I fixed it by editing the postgresql-14.service PGDATA path to the new
directory

Thanks,

butching

On Mon, Oct 24, 2022 at 7:25 PM chris navarroza <canavarroza.work@gmail.com>
wrote:

Show quoted text

But I'm using a different path when I initdb /usr/pgsql-14/bin/initdb -D */home/dmartuser/pgsql/14/data
*so "/var/lib/pgsql/14/data/" is really empty. Is there a way to point
the startup script to the new path */home/dmartuser/pgsql/14/data* ?

Thanks,

Chris Albert Navarroza
Information Technology Officer I
CTCO - ITDS - RDMD

On Mon, Oct 24, 2022 at 6:57 PM Jeffrey Walton <noloader@gmail.com> wrote:

On Mon, Oct 24, 2022 at 6:38 AM chris navarroza
<canavarroza.work@gmail.com> wrote:

I install postgresql14.5 with the following commands

sudo yum install postgresql14-server postgresql14-contrib

sudo su postgres

cd /tmp

/usr/pgsql-14/bin/initdb -D /home/dmartuser/pgsql/14/data

and update the postgresql.conf to the new path, now when I start the

service, it has an error and when I check it says

-- Unit postgresql-14.service has begun starting up.
Oct 24 15:16:45 datamartds postgresql-14-check-db-dir[132338]:

"/var/lib/pgsql/14/data/" is missing or empty.

Oct 24 15:16:45 datamartds postgresql-14-check-db-dir[132338]: Use

"/usr/pgsql-14/bin/postgresql-14-setup initdb" to initialize the database
cluster.

Oct 24 15:16:45 datamartds postgresql-14-check-db-dir[132338]: See

/usr/share/doc/postgresql14/README.rpm-dist for more information.

Oct 24 15:16:45 datamartds systemd[1]: postgresql-14.service: Control

process exited, code=exited status=1

Oct 24 15:16:45 datamartds systemd[1]: postgresql-14.service: Failed

with result 'exit-code'.

How can I point the service to read the new path (

/home/dmartuser/pgsql/14/data )?

The startup script that is calling systemd should perform a `mkdir -p
/var/lib/pgsql/14/data` before calling the PostgreSQL binary.

Jeff