Обсуждение: postgresql service started but pid is not saved in /var/run/postgresql/postgresql.pid

Поиск
Список
Период
Сортировка

postgresql service started but pid is not saved in /var/run/postgresql/postgresql.pid

От
Mariel Cherkassky
Дата:
Hey,
I'm using a machine in aws and when the machine starts all the services are starting including postgresql(v9.6 , centos).  However, when I check the service`s status I see that it is stopped but all the processes are up (ps -ef ) and the postmaster.pid file is exist with the pid of the postmaster. 

The next part of code responsible for starting postgresql in redhat(/etc/init.d/postgresql) :
$SU -l postgres -c "$PGENGINE/postmaster -D '$PGDATA' ${PGOPTS} >>\"$PGLOG\" 2>&1 &"
        sleep 2
        pid=`head -n 1 "$PGDATA/postmaster.pid" 2>/dev/null`
        if [ "x$pid" != x ]
        then
                success "$PSQL_START"
                touch "$lockfile"
                echo $pid > "$pidfile"
                echo
        else
                failure "$PSQL_START"
                echo
                script_result=1
        fi

It seems that the sleep 2 isnt enough time to start the processes and thats why the service shows that the instance is down while it is up. Does any one faced this type of issue ? I mean, I can increase the sleep , but I dont think that it is the perfect solution in this case.

Re: postgresql service started but pid is not saved in /var/run/postgresql/postgresql.pid

От
Juan José Santamaría Flecha
Дата:

On Tue, May 14, 2019 at 11:20 AM Mariel Cherkassky <mariel.cherkassky@gmail.com> wrote:
Hey,
I'm using a machine in aws and when the machine starts all the services are starting including postgresql(v9.6 , centos).  However, when I check the service`s status I see that it is stopped but all the processes are up (ps -ef ) and the postmaster.pid file is exist with the pid of the postmaster. 

The next part of code responsible for starting postgresql in redhat(/etc/init.d/postgresql) :


This seems to be old code, you can find the example of a start/stop script for 9.6 in:

 

It seems that the sleep 2 isnt enough time to start the processes and thats why the service shows that the instance is down while it is up. Does any one faced this type of issue ? I mean, I can increase the sleep , but I dont think that it is the perfect solution in this case.


What CentOS version are you using, wouldn't it be more appropriate to use systemctl anyway?

Regards,

Juan José Santamaría Flecha

Re: postgresql service started but pid is not saved in /var/run/postgresql/postgresql.pid

От
Mariel Cherkassky
Дата:
The link you mentioned, suppose to be the new service file ? Weird because I got the most updated rpm installed (of 9.6 version).
My OS version is centos 6.

‫בתאריך יום ג׳, 14 במאי 2019 ב-14:29 מאת ‪Juan José Santamaría Flecha‬‏ <‪juanjo.santamaria@gmail.com‬‏>:‬

On Tue, May 14, 2019 at 11:20 AM Mariel Cherkassky <mariel.cherkassky@gmail.com> wrote:
Hey,
I'm using a machine in aws and when the machine starts all the services are starting including postgresql(v9.6 , centos).  However, when I check the service`s status I see that it is stopped but all the processes are up (ps -ef ) and the postmaster.pid file is exist with the pid of the postmaster. 

The next part of code responsible for starting postgresql in redhat(/etc/init.d/postgresql) :


This seems to be old code, you can find the example of a start/stop script for 9.6 in:

 

It seems that the sleep 2 isnt enough time to start the processes and thats why the service shows that the instance is down while it is up. Does any one faced this type of issue ? I mean, I can increase the sleep , but I dont think that it is the perfect solution in this case.


What CentOS version are you using, wouldn't it be more appropriate to use systemctl anyway?

Regards,

Juan José Santamaría Flecha

Re: postgresql service started but pid is not saved in /var/run/postgresql/postgresql.pid

От
Juan José Santamaría Flecha
Дата:

On Tue, May 14, 2019 at 3:11 PM Mariel Cherkassky <mariel.cherkassky@gmail.com> wrote:
The link you mentioned, suppose to be the new service file ? Weird because I got the most updated rpm installed (of 9.6 version).
My OS version is centos 6.


The script I have pointed to is from the Postgres source, the one you are getting from the rpm comes, most likely, from the distro-builder.

FWIW I think they should be similar, but in this case yours looks old.

Regards,

Juan José Santamaría Flecha

Re: postgresql service started but pid is not saved in /var/run/postgresql/postgresql.pid

От
Mariel Cherkassky
Дата:
I installed postgresql with the rpms that are available from the postgresql official repository. I'm not familiar with distro-builder, can you explain what is it ? The file in your link doesnt look like my postgresql service file.



‫בתאריך יום ג׳, 14 במאי 2019 ב-17:34 מאת ‪Juan José Santamaría Flecha‬‏ <‪juanjo.santamaria@gmail.com‬‏>:‬

On Tue, May 14, 2019 at 3:11 PM Mariel Cherkassky <mariel.cherkassky@gmail.com> wrote:
The link you mentioned, suppose to be the new service file ? Weird because I got the most updated rpm installed (of 9.6 version).
My OS version is centos 6.


The script I have pointed to is from the Postgres source, the one you are getting from the rpm comes, most likely, from the distro-builder.

FWIW I think they should be similar, but in this case yours looks old.

Regards,

Juan José Santamaría Flecha

Re: postgresql service started but pid is not saved in /var/run/postgresql/postgresql.pid

От
Juan José Santamaría Flecha
Дата:

On Wed, May 15, 2019 at 9:19 AM Mariel Cherkassky <mariel.cherkassky@gmail.com> wrote:
I installed postgresql with the rpms that are available from the postgresql official repository. I'm not familiar with distro-builder, can you explain what is it ? The file in your link doesnt look like my postgresql service file.


Some parts of software installed from rpms is specific to each distro There is a PostgreSQL RPM Building Project that takes care of maintain the repository.

There is nothing wrong with the installation path you have followed, but if you had installed from source you could have ended with a different start script. The source is maintaned by the Postgres Core Team.

Regards,

Juan José Santamaría Flecha