powa-team / powa

PostgreSQL Workload Analyzer
http://powa.readthedocs.io/
PostgreSQL License
768 stars 57 forks source link

Postgresql: Error starting the service postgresql-10.service #111

Closed KewtonV closed 5 years ago

KewtonV commented 5 years ago

Hi guys... I installed the "dnf install postgresql10 postgresql10-server" in my Fedora 28 using these instructions: https://www.if-not-true-then-false.com/2012/install-postgresql-on-fedora-centos-red-hat-rhel/ I also installed postgresql-devel and postgresql-contrib But when I was "started" with the command "systemctl start postgresql-10.service" the following error occurred:

[root@localhost Kewton]# systemctl start postgresql-10.service

Job for postgresql-10.service failed because the control process exited with error code. See "systemctl status postgresql-10.service" and "journalctl -xe" for details.

[root@localhost Kewton]# systemctl status postgresql-10.service

postgresql-10.service - PostgreSQL 10 database server Loaded: loaded (/usr/lib/systemd/system/postgresql-10.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2018-10-27 06:03:55 -03; 1min 9s ago Docs: https://www.postgresql.org/docs/10/static/ Process: 5783 ExecStart=/usr/pgsql-10/bin/postmaster -D ${PGDATA} (code=exited, status=1/FAILURE) Process: 5778 ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS) Main PID: 5783 (code=exited, status=1/FAILURE)

out 27 06:03:55 localhost.localdomain postmaster[5783]: 2018-10-27 06:03:55.140 -03 [5783] LOG: listening on IPv4 address "0.0.0.0", port 5432 out 27 06:03:55 localhost.localdomain postmaster[5783]: 2018-10-27 06:03:55.140 -03 [5783] LOG: listening on IPv6 address "::", port 5432 out 27 06:03:55 localhost.localdomain postmaster[5783]: 2018-10-27 06:03:55.152 -03 [5783] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" out 27 06:03:55 localhost.localdomain postmaster[5783]: 2018-10-27 06:03:55.167 -03 [5783] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432" out 27 06:03:55 localhost.localdomain postmaster[5783]: 2018-10-27 06:03:55.193 -03 [5783] LOG: redirecting log output to logging collector process out 27 06:03:55 localhost.localdomain postmaster[5783]: 2018-10-27 06:03:55.193 -03 [5783] HINT: Future log output will appear in directory "log". out 27 06:03:55 localhost.localdomain systemd[1]: postgresql-10.service: Main process exited, code=exited, status=1/FAILURE out 27 06:03:55 localhost.localdomain systemd[1]: postgresql-10.service: Killing process 5785 (postmaster) with signal SIGKILL. out 27 06:03:55 localhost.localdomain systemd[1]: postgresql-10.service: Failed with result 'exit-code'. out 27 06:03:55 localhost.localdomain systemd[1]: Failed to start PostgreSQL 10 database server.

Can you help me?

rjuju commented 5 years ago

You have this message:

HINT: Future log output will appear in directory "log".

Can you paste the content of the latest file in this directory? The reason why postgres didn't start is written there. I'm not a fedora user, but according to the documentation you linked, this directory should be located in /var/lib/pgsql/10/data/.

KewtonV commented 5 years ago

Hi rjuju.

Thanks for the attention to my problem. I believe this is the file, correct? "postgresql-Sat.log"

2018-10-27 05:41:57.774 -03 [1472] LOG: specifying both host name and CIDR mask is invalid: "xx.xx.xx.xx/xx" 2018-10-27 05:41:57.774 -03 [1472] CONTEXT: line 92 of configuration file "/var/lib/pgsql/10/data/pg_hba.conf" 2018-10-27 05:41:57.774 -03 [1472] FATAL: could not load pg_hba.conf 2018-10-27 05:41:57.775 -03 [1472] LOG: database system is shut down 2018-10-27 06:03:55.193 -03 [5783] LOG: specifying both host name and CIDR mask is invalid: "xx.xx.xx.xx/xx" 2018-10-27 06:03:55.193 -03 [5783] CONTEXT: line 92 of configuration file "/var/lib/pgsql/10/data/pg_hba.conf" 2018-10-27 06:03:55.193 -03 [5783] FATAL: could not load pg_hba.conf 2018-10-27 06:03:55.195 -03 [5783] LOG: database system is shut down

rjuju commented 5 years ago

So, your problem is

FATAL: could not load pg_hba.conf
LOG: specifying both host name and CIDR mask is invalid: "xx.xx.xx.xx/xx"
 CONTEXT: line 92 of configuration file "/var/lib/pgsql/10/data/pg_hba.conf"

This is not related to powa, just a misconfiguration in the pg_hba.conf file, at line 92.

You can refer to https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html to see how to correctly setup this file.

mounirhmd commented 5 years ago

Hello same problem for me any help!!??

systemctl status postgresql-10.service

● postgresql-10.service - PostgreSQL 10 database server Loaded: loaded (/usr/lib/systemd/system/postgresql-10.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since lun. 2019-05-13 17:30:44 CEST; 1min 19s ago Docs: https://www.postgresql.org/docs/10/static/ Process: 23380 ExecStart=/usr/pgsql-10/bin/postmaster -D ${PGDATA} (code=exited, status=1/FAILURE) Process: 23373 ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS) Main PID: 23380 (code=exited, status=1/FAILURE)

mai 13 17:30:44 lapp-esc01.in2p3.fr systemd[1]: Starting PostgreSQL 10 database server... mai 13 17:30:44 lapp-esc01.in2p3.fr postmaster[23380]: 2019-05-13 17:30:44.118 CEST [23380] LOG: n'a pas pu lier IPv6 à l'adresse « ::1 » : Adresse déjà utilisée mai 13 17:30:44 lapp-esc01.in2p3.fr postmaster[23380]: 2019-05-13 17:30:44.118 CEST [23380] ASTUCE : Un autre postmaster fonctionne-t'il déjà sur le port 5432 ? mai 13 17:30:44 lapp-esc01.in2p3.fr postmaster[23380]: Sinon, attendez quelques secondes et réessayez. mai 13 17:30:44 lapp-esc01.in2p3.fr postmaster[23380]: 2019-05-13 17:30:44.118 CEST [23380] LOG: n'a pas pu lier IPv4 à l'adresse « 127.0.0.1 » : Adresse déjà utilisée mai 13 17:30:44 lapp-esc01.in2p3.fr systemd[1]: postgresql-10.service: main process exited, code=exited, status=1/FAILURE mai 13 17:30:44 lapp-esc01.in2p3.fr systemd[1]: Failed to start PostgreSQL 10 database server. mai 13 17:30:44 lapp-esc01.in2p3.fr systemd[1]: Unit postgresql-10.service entered failed state. mai 13 17:30:44 lapp-esc01.in2p3.fr systemd[1]: postgresql-10.service failed.

rjuju commented 5 years ago

Hello,

Here again this is not a powa issue but a postgresql issue. You're trying to start a postgres instance (version 10) on port 5432 on localhost, but there's already a service using that port and address. If you have multiple instances running, please read the documentation on the packages you're using to check how to properly configure the port for the new instance. Otherwise, check if the instance was start manually.

mounirhmd commented 5 years ago

Hello,

Here again this is not a powa issue but a postgresql issue. You're trying to start a postgres instance (version 10) on port 5432 on localhost, but there's already a service using that port and address. If you have multiple instances running, please read the documentation on the packages you're using to check how to properly configure the port for the new instance. Otherwise, check if the instance was start manually.

Hi rjuju, I checked what you said but it seems the port it is used only by postgres ~]# netstat -tulnp tcp 0 0 127.0.0.1:5432 0.0.0.0: LISTEN 30200/postgres tcp6 0 0 ::1:5432 ::: LISTEN 30200/postgres

rjuju commented 5 years ago

Yes, and I wouldn't expect a different process using this port.

If your pg10 instance is stopped and you see this port opened, it means that another instance is running on the same port, which is your problem. Check what is pid 30200 to know which instance is using the port you want to use with your pg10 instance.

mounirhmd commented 5 years ago

Yes, and I wouldn't expect a different process using this port.

If your pg10 instance is stopped and you see this port opened, it means that another instance is running on the same port, which is your problem. Check what is pid 30200 to know which instance is using the port you want to use with your pg10 instance.

Hi rjuju, I checked out and i got this: ps aux | grep -i 30200

root 9744 0.0 0.0 112728 1000 pts/0 S+ 12:37 0:00 grep --color=auto -i 30200 postgres 30200 0.0 0.0 235576 9376 ? S mai07 0:28 /usr/bin/postgres -D /var/lib/pgsql/data -p 5432

rjuju commented 5 years ago

Is this done while your pg10 instance is down? Which package is this /usr/bin/postgres binary coming from, and what do you get is you connect on port 5432?

I don't know how you setup your server, but it looks like you have a default postgres installed from OS official repository, and on top of that tried to setup the pgdg repository to install pg10, which conflicts with the original postgres installed from OS. Is that the case?

mounirhmd commented 5 years ago

Is this done while your pg10 instance is down? Which package is this /usr/bin/postgres binary coming from, and what do you get is you connect on port 5432?

I don't know how you setup your server, but it looks like you have a default postgres installed from OS official repository, and on top of that tried to setup the pgdg repository to install pg10, which conflicts with the original postgres installed from OS. Is that the case?

Hi rjuju, I think yes that is the problem I installed pg but i needed a new version not old one so i tried to update it, should I remove it or it will complicate things.?

rjuju commented 5 years ago

If you don't have data on this instance (or if you don't care about those data), it's better to entirely remove the old one (as in removing the package and remove all underlying data). The details are specific to the operating system you're using, so you might want to look on some documentation on how to entirely prune everything.

It's usually a good practice to use either OS vanilla postgres or pgdg repository, but not both.

mounirhmd commented 5 years ago

If you don't have data on this instance (or if you don't care about those data), it's better to entirely remove the old one (as in removing the package and remove all underlying data). The details are specific to the operating system you're using, so you might want to look on some documentation on how to entirely prune everything.

It's usually a good practice to use either OS vanilla postgres or pgdg repository, but not both.

Hi rjuju, Thank you for your help 👍 now it's working, I had to remove postgresql and reinstalled again.