Support Questions
Find answers, ask questions, and share your expertise

unable to start postgres for ambari

Super Guru

I am trying to start ambari and it fails while starting postgres on the sandbox.

[root@sandbox ~]# ambari-server restart Using python /usr/bin/python2 Restarting ambari-server Using python /usr/bin/python2 Stopping ambari-server Ambari Server is not running Using python /usr/bin/python2 Starting ambari-server Ambari Server running with administrator privileges. Running initdb: This may take upto a minute. About to start PostgreSQL ERROR: Exiting with exit code 3. REASON: Unable to start PostgreSQL server. Status stopped. . Exiting

I tried to start postgres

[root@sandbox ~]# service postgresql start Starting postgresql service: [FAILED]

Then I ran a postgres status:

[root@sandbox ~]# service postgresql status postmaster is stopped

I am not sure how to start postmaster. I tried

[root@sandbox ~]# pg_ctl start pg_ctl: cannot be run as root Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process.

Any other ideas?

19 REPLIES 19

su - postgres
pg_ctl status
pg_ctl start

Super Guru

@Jitendra Yadav thanks for your response. It did not work.

I didn't expected it to work 🙂 , just shared because you had issue with pg_ctl start pg_ctl with root.

can you please check postgres logs on below location and see if there is any clue?

/var/lib/pgsql/data/pg_log

Super Guru

@Jitendra Yadav I looked at the logs and all I found is this:

CONTEXT: line 79 of configuration file "/var/lib/pgsql/data/pg_hba.conf"

FATAL: could not load pg_hba.conf

Any ideas?

Sunile, is there anything interesting in /var/lib/pgsql/pgstartup.log?

Explorer

Please check /tmp permissions then restart ambari server.

Explorer

Also select Enter advanced database configuration [y/n] (n)? y

Super Guru

5491-2016-07-04-23-08-00.jpg

@Mudit Kumar tmp permissions look good. How do I enter advanced database configuration? And why?

Super Guru

@slachterman I check the pgstartup.log and see this:

runuser: cannot set groups: Operation not permitted runuser: cannot set groups: Operation not permitted runuser: cannot set groups: Operation not permitted runuser: cannot set groups: Operation not permitted

Explorer

hi @Sunile Manjee: Were you able to resolve the issue?

Super Guru

No. i just started all over

Explorer

oh okay. any clue on what the error might be?

Explorer

login as root

[root@Node0 ~]$
[root@Node0 ~]$ cd /var/lib/pgsql  
[root@Node0 ~]$ su - postgres 
[root@Node0 pgsql]$ sudo su  - postgres
-bash-4.2 $ grep listen /var/lib/pgsql/data/postgresql.conf

#listen_addresses = 'localhost'		# what IP address(es) to listen on;
-bash-4.2 $ vi /var/lib/pgsql/data_bkp/postgresql.conf

Find listen_address= 'localhost' and change to local_address='*', then and exit vi, then exit back to root.

service postgresql restart

Redirecting to /bin/systemctl restart postgresql.service

[root@Node0 ~]$ ambari-server setup

and accept all prompts, and when ambari-server setup will successfully complete,

[root@Node0 ~]$ ambari-server start 

Ambari Server 'start' completed successfully.

Contributor
@Alexander Daher

Thank you!!!... The steps worked for me.
I have small question, my linux server on which the ambari-server is running rebooted as it went unresponsive, so in this how only postgresql service stopped and other all services were running? any idea?

New Contributor
ambari-server start

On running the above command, I was encountering the same error while starting Ambari-server, where ambari failed to start the Postgresql server with error 3.

I figured out the following solution to start ambari-server.

You can check the status using

service postgresql status

This gives the status of the service running as PostgreSQL. In case this is giving the error that the service is not running and the server failed to start, you can check the reason with the following commands:

systemctl status postgresql.service

If the reasons show anything related to the port and the listener like:

45631-capture.jpg

Then navigate to the following path and check the versions:

ls /var/lib/pgsql

In case you find other folders like 9.6 or 9.5, for example, 9.6, then try and check if postgresql-9.6 is running.

service postgresql-9.6 status
systemctl status postgresql-9.6.service

In case you find that this is running, you will have to stop the service and chkconfig it to off.

service postgresql-9.6 stop
chkconfig postgresql-9.6 off

Try and restart the ambari-server now and this might work, as the ambari server tries to start the postgresql using /var/lib/pgsql/data/postgresql.conf and not the 9.6 version configuration. In order to stop facilitate the server to use the default configuration, we have to stop the server on 9.6 version or point ambari to 9.6 version pgsql.

ambari-server start
ambari-server status

New Contributor

i have the same issue on HDP 3.1 upgrade where postgress service failing to start after ambari upgraded


New Contributor

i have the same issue on HDP 3.1 upgrade where postgress service failing to start after ambari upgraded

New Contributor

i have same issue today after upgrade ambari for 3.1 the postgresql service is not starting / any idea .

Hi @rushi_ns ,

 

yours might be completly different issue.

Please create a new Question thread stating your issue.

 

; ;