4

Installed PostgreSQL using:

sudo yum install postgresql-server postgresql-contrib

PostgreSQL version: 9.2.18

When start service:

sudo service postgresql start

Got error:

Redirecting to /bin/systemctl start postgresql.service
Job for postgresql.service failed because the control process exited with error code. See "systemctl status postgresql.service" and "journalctl -xe" for details.

The journalctl -xe detail:

-- Unit postgresql.service has failed.
--
-- The result is failed.
 7月 19 04:17:04 node2 systemd[1]: Unit postgresql.service entered failed state.
 7月 19 04:17:04 node2 systemd[1]: postgresql.service failed.
 7月 19 04:17:04 node2 polkitd[19772]: Unregistered Authentication Agent for unix-process:27133:53830492 (system bus name :1.405, object path /org/freedesktop/PolicyKit1/AuthenticationA
 7月 19 04:19:33 node2 polkitd[19772]: Registered Authentication Agent for unix-process:27165:53845472 (system bus name :1.406 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object pat
 7月 19 04:19:33 node2 systemd[1]: Starting PostgreSQL database server...
-- Subject: Unit postgresql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit postgresql.service has begun starting up.
 7月 19 04:19:34 node2 pg_ctl[27187]: pg_ctl: could not start server
 7月 19 04:19:34 node2 pg_ctl[27187]: Examine the log output.
 7月 19 04:19:34 node2 systemd[1]: postgresql.service: control process exited, code=exited status=1
 7月 19 04:19:34 node2 systemd[1]: Failed to start PostgreSQL database server.
-- Subject: Unit postgresql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit postgresql.service has failed.
--
-- The result is failed.
 7月 19 04:19:34 node2 systemd[1]: Unit postgresql.service entered failed state.
 7月 19 04:19:34 node2 systemd[1]: postgresql.service failed.
 7月 19 04:19:34 node2 polkitd[19772]: Unregistered Authentication Agent for unix-process:27165:53845472 (system bus name :1.406, object path /org/freedesktop/PolicyKit1/AuthenticationA
lines 2850-2910/2910 (END)

Run systemctl status PostgreSQL.service, got this information:

くろまる postgresql.service - PostgreSQL database server
 Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
 Active: failed (Result: exit-code) since Wed 2017年07月19日 04:30:26 EDT; 42min ago
 Process: 27285 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=1/FAILURE)
 Process: 27280 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
 Main PID: 26640 (code=exited, status=0/SUCCESS)
asked Jul 19, 2017 at 8:23
1
  • What are your PostgreSQL logs ? Commented Jul 19, 2017 at 12:53

3 Answers 3

3

You have 3 steps before being abble to connect to a PostgreSQL Database:

  • Install PostgreSQL
  • Create the data cluster ($PGDATA)
  • Start the server

You already installed PostgreSQL, you need now to create the cluster. The initdb tool is what you need.

You will find documentation here.

It might be confusing because when you're under a debian based distros, apt and perl wrappers do every steps for you.

isapir
2692 silver badges5 bronze badges
answered Jul 19, 2017 at 9:33
3
  • Thank you. I did all of those. I followed this guide to do the replication: digitalocean.com/community/tutorials/…. After I created a recovery.conf file and added this to it: trigger_file = '/tmp/postgresql.trigger.5432', the service PostgreSQL start command didn't work. I think it's the reason. Commented Jul 19, 2017 at 9:48
  • Ok, you didn't mention any of that... Commented Jul 19, 2017 at 12:53
  • After I reinstall PostgreSQL, works. Commented Jul 20, 2017 at 3:11
1

In my case it was the shared_buffers was too big that cased the failed state, I decrease it to 128MB and restarted then worked fine, my case was I made a copy of the data directory after an OS crash to a new OS .

McNets
24k11 gold badges51 silver badges90 bronze badges
answered Jan 30, 2019 at 23:56
0

Same behaviour to me. In my case there were wrong permissions on PGDATA. It was logged only in detail in /var/log/messages. chmod 700 data helped to get the standby node up and running.

answered Jun 24, 2022 at 10:41

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.