Select to view content in your preferred language

"no pg_hba.conf entry" issue in Portal's internal database

2516
5
08-13-2023 02:36 PM
UalasRohrer
Regular Contributor

After a sudden shutdown of the VM, the ArcGIS Portal is not working anymore. It's a basic ArcGIS Enterprise 10.9.1 running on Ubuntu and deployed by Chef.

 

That's Portal log (/opt/arcgis/portal/usr/arcgisportal/logs/gis.spatialstudieslab.org/portal):

 

<Msg time="2023-08-13T16:00:11,409" type="SEVERE" code="218010" source="Portal Admin" process="56639" thread="1" methodName="" machine="GIS.SPATIALSTUDIESLAB.ORG" user="" elapsed="" requestID="">The portal has been initialized and configured but is not accessible. The internal portal database does not appear to be running or accepting connections. Restart the portal machine or machines and if the problem persists, contact Esri technical support (U.S.) or your distributor (customers outside the U.S.).</Msg>

 

 

That's the portal internal database log (/opt/arcgis/portal/usr/arcgisportal/logs/database/pg_log/{postgresql}):

 

2023-08-13 14:00:41 PDT: [57068]: LOG:  database system was shut down at 2023-08-13 13:59:36 PDT
2023-08-13 14:00:41 PDT: [57066]: LOG:  database system is ready to accept connections
2023-08-13 14:00:41 PDT: [57078]: FATAL:  no pg_hba.conf entry for host "[local]", user "arcgis", database "arcgis", SSL off

 

 

That's my /opt/arcgis/portal/usr/arcgisportal/db/pg_hba.conf

 

# "local" is for Unix domain socket connections only
local   all             ualas                                     scram-sha-256
local   replication     ualas                                     scram-sha-256
# IPv4 local connections:
host    all             ualas             127.0.0.1/32            scram-sha-256
host    replication     ualas             127.0.0.1/32            scram-sha-256
# IPv6 local connections:
host    all             ualas             ::1/128                 scram-sha-256
host    replication     ualas             ::1/128                 scram-sha-256

 

 

I've tried adding very broad permissions entry to pg_hba.conf and it returns now:

 

2023-08-13 12:43:51 PDT: [30647]: LOG:  database system is ready to accept connections
2023-08-13 12:43:52 PDT: [30671]: FATAL:  password authentication failed for user "arcgis"
2023-08-13 12:43:52 PDT: [30671]: DETAIL:  Role "arcgis" does not exist.
        Connection matched pg_hba.conf line 17: "local   arcgis          arcgis                                     scram-sha-256"
2023-08-13 12:43:52 PDT: [30671]: LOG:  could not send data to client: Broken pipe

 

 

Is the portal using the wrong user to connect to the database? My /opt/arcgis/portal/usr/arcgisportal/db/config-store-connection.json is using the same username as my admin account in the Portal:

 

"username": "ualas"

 

 

arcgis is the ubuntu user that installed the software.

I also tried recovering my latest full backup, which did not fix the issue.

I appreciate any guidance.

 

5 Replies
ChristopherPawlyszyn
Esri Contributor

I'd recommend looking more into the portal log directory, as the improper database connections are related to BUG-000134945 and shouldn't causing the inability for Portal for ArcGIS to start successfully.


-- Chris Pawlyszyn
0 Kudos
UalasRohrer
Regular Contributor

Thanks for the reply @ChristopherPawlyszyn . Just adding a piece of extra information, I'm using ArcGIS Enterprise 10.9.1. Find below my portal logs:

/opt/arcgis/portal/usr/arcgisportal/logs/gis.spatialstudieslab.org/portal/portal-20230814.073901-141825-0.0.log

<Msg time="2023-08-14T07:39:17,247" type="SEVERE" code="218010" source="Portal Admin" process="141825" thread="1" methodName="" machine="GIS.SPATIALSTUDIESLAB.ORG" user="" elapsed="" requestID="">The portal has been initialized and configured but is not accessible. The internal portal database does not appear to be running or accepting connections. Restart the portal machine or machines and if the problem persists, contact Esri technical support (U.S.) or your distributor (customers outside the U.S.).</Msg>
<Msg time="2023-08-14T07:39:17,247" type="WARNING" code="218012" source="Portal Admin" process="141825" thread="1" methodName="" machine="GIS.SPATIALSTUDIESLAB.ORG" user="" elapsed="" requestID="">Error at check and update urls. The portal is currently unavailable. Please contact your portal administrator.</Msg>
<Msg time="2023-08-14T07:39:23,283" type="SEVERE" code="218010" source="Portal Admin" process="141825" thread="1" methodName="" machine="GIS.SPATIALSTUDIESLAB.ORG" user="" elapsed="" requestID="">The portal has been initialized and configured but is not accessible. The internal portal database does not appear to be running or accepting connections. Restart the portal machine or machines and if the problem persists, contact Esri technical support (U.S.) or your distributor (customers outside the U.S.).</Msg>
<Msg time="2023-08-14T07:39:23,497" type="WARNING" code="218014" source="Portal" process="141825" thread="1" methodName="" machine="GIS.SPATIALSTUDIESLAB.ORG" user="" elapsed="" requestID="">Starting Index Service.</Msg>
<Msg time="2023-08-14T07:39:47,550" type="WARNING" code="218015" source="Portal" process="141825" thread="1" methodName="" machine="GIS.SPATIALSTUDIESLAB.ORG" user="" elapsed="" requestID="">Started Index Service.</Msg>
<Msg time="2023-08-14T07:39:47,577" type="WARNING" code="217060" source="Portal" process="141825" thread="1" methodName="" machine="GIS.SPATIALSTUDIESLAB.ORG" user="" elapsed="" requestID="">The database server was found to be stopped. Re-starting it.</Msg>
<Msg time="2023-08-14T07:39:53,455" type="WARNING" code="217064" source="Portal" process="141825" thread="1" methodName="" machine="GIS.SPATIALSTUDIESLAB.ORG" user="" elapsed="" requestID="">The web server was found to be stopped. Re-starting it.</Msg>

 

/opt/arcgis/portal/usr/arcgisportal/logs/database/pg_log/postgresql-2023-08-14_053947.log

2023-08-14 05:39:47 PDT: [142282]: LOG:  database system was shut down at 2023-08-14 05:29:07 PDT
2023-08-14 05:39:47 PDT: [142278]: LOG:  database system is ready to accept connections
2023-08-14 05:39:48 PDT: [142292]: FATAL:  no pg_hba.conf entry for host "[local]", user "arcgis", database "arcgis", SSL off

 

/opt/arcgis/portal/usr/arcgisportal/logs/service/service-0.log

Mon Aug 14 07:38:56.021 CDT 2023 WARNING: Could not connect to Log service. Writing log message to console.
Mon Aug 14 07:38:56.022 CDT 2023        <Msg time="2023-08-14T07:38:55,979" type="INFO" code="217081" source="Portal" process="141825" thread="1" methodName="" machine="" user="" elapsed="" requestID="">Configuring IndexServer password.</Msg>

Mon Aug 14 07:38:56.338 CDT 2023 WARNING: Could not connect to Log service. Writing log message to console.
Mon Aug 14 07:38:56.339 CDT 2023        <Msg time="2023-08-14T07:38:56,336" type="INFO" code="217083" source="Portal" process="141825" thread="1" methodName="" machine="" user="" elapsed="" requestID="">IndexServer configuration complete.</Msg>

Mon Aug 14 07:38:56.358 CDT 2023 NodeAgent loaded observer 'HostnameObserver'.
Mon Aug 14 07:38:56.359 CDT 2023 NodeAgent loaded observer 'LogServiceObserver'.
Mon Aug 14 07:39:01.406 CDT 2023 NodeAgent loaded observer 'ConfigObserver'.
Mon Aug 14 07:39:01.407 CDT 2023 NodeAgent loaded observer 'Portal Upgrader'.
Mon Aug 14 07:39:01.407 CDT 2023 WARNING: Could not connect to Log service. Writing log message to console.
Mon Aug 14 07:39:01.407 CDT 2023        <Msg time="2023-08-14T07:39:01,405" type="SEVERE" code="218010" source="Portal Admin" process="141825" thread="1" methodName="" machine="" user="" elapsed="" requestID="">The portal has been initialized and configured but is not accessible. The internal portal database does not appear to be running or accepting connections. Restart the portal machine or machines and if the problem persists, contact Esri technical support (U.S.) or your distributor (customers outside the U.S.).</Msg>

Mon Aug 14 07:39:01.417 CDT 2023 NodeAgent loaded observer 'PatchObserver'.
Mon Aug 14 07:39:01.419 CDT 2023 WARNING: Could not connect to Log service. Writing log message to console.
Mon Aug 14 07:39:01.419 CDT 2023        <Msg time="2023-08-14T07:39:01,417" type="INFO" code="218000" source="Portal" process="141825" thread="1" methodName="" machine="" user="" elapsed="" requestID="">No patch file found, skipping application of patch at startup.</Msg>

Mon Aug 14 07:39:01.429 CDT 2023 NodeAgent loaded observer 'SetupObserver'.
Mon Aug 14 07:39:01.437 CDT 2023 NodeAgent loaded plugin 'ProcessMonitor'.
Mon Aug 14 07:39:01.441 CDT 2023 NodeAgent loaded plugin 'HAMonitor'.
Mon Aug 14 07:39:01.442 CDT 2023 NodeAgent loaded plugin 'UninstallPlugin'.
Mon Aug 14 07:39:01.449 CDT 2023 NodeAgent loaded plugin 'LogFileLimiter'.
Mon Aug 14 07:39:01.450 CDT 2023 NodeAgent loaded plugin 'DiskspaceMonitor'.
Mon Aug 14 07:39:01.451 CDT 2023 NodeAgent loaded plugin 'PortalIndexMonitorPlugin'.
Mon Aug 14 07:39:01.453 CDT 2023 WARNING: Could not connect to Log service. Writing log message to console.
Mon Aug 14 07:39:01.453 CDT 2023        <Msg time="2023-08-14T07:39:01,451" type="INFO" code="217070" source="Portal" process="141825" thread="1" methodName="" machine="" user="" elapsed="" requestID="">Starting portal.</Msg>

Mon Aug 14 07:39:01.455 CDT 2023 WARNING: Could not connect to Log service. Writing log message to console.
Mon Aug 14 07:39:01.455 CDT 2023        <Msg time="2023-08-14T07:39:01,452" type="INFO" code="217071" source="Portal" process="141825" thread="1" methodName="" machine="" user="" elapsed="" requestID="">Starting JMX server.</Msg>

Mon Aug 14 07:39:01.618 CDT 2023 WARNING: Could not connect to Log service. Writing log message to console.
Mon Aug 14 07:39:01.619 CDT 2023        <Msg time="2023-08-14T07:39:01,570" type="INFO" code="217090" source="Portal" process="141825" thread="1" methodName="" machine="" user="" elapsed="" requestID="">Validating the hostname 'gis.spatialstudieslab.org' configured in the hostname.properties file.</Msg>

Mon Aug 14 07:39:01.625 CDT 2023 WARNING: Could not connect to Log service. Writing log message to console.
Mon Aug 14 07:39:01.625 CDT 2023        <Msg time="2023-08-14T07:39:01,572" type="INFO" code="217091" source="Portal" process="141825" thread="1" methodName="" machine="" user="" elapsed="" requestID="">Hostname 'gis.spatialstudieslab.org' configured in the hostname.properties is valid.</Msg>

Mon Aug 14 07:39:01.631 CDT 2023 WARNING: Could not connect to Log service. Writing log message to console.
Mon Aug 14 07:39:01.631 CDT 2023        <Msg time="2023-08-14T07:39:01,619" type="INFO" code="217037" source="Portal" process="141825" thread="1" methodName="" machine="" user="" elapsed="" requestID="">Log Service not started. Restarting it.</Msg>

Mon Aug 14 07:39:01.639 CDT 2023 WARNING: Could not connect to Log service. Writing log message to console.
Mon Aug 14 07:39:01.639 CDT 2023        <Msg time="2023-08-14T07:39:01,619" type="INFO" code="217038" source="Portal" process="141825" thread="1" methodName="" machine="" user="" elapsed="" requestID="">Registering and starting log service.</Msg>

 

Do you have any suggestion?

0 Kudos
ChristopherPawlyszyn
Esri Contributor

A few questions come to mind:

  1. Since you're using a hostname.properties file, does the DNS still resolve to the IP address of the local machine?
  2. Can you access Portal for ArcGIS via port 7443 directly?
  3. Any disk space issues on the VM?

If you're unable to access 7443, I would suspect an issue with the web server (Tomcat) startup. If that may be the issue, you can validate the server.xml file is in-tact in /opt/arcgis/portal/framework/runtime/tomcat/conf by comparing to another working system or look at the logs in ../framework/runtime/tomcat/logs for additional clues.


-- Chris Pawlyszyn
0 Kudos
PaulaGuzmanM
Esri Contributor

Hi UalasRohrer!

I suggest you modify the pg_hba.conf file by adding the lines that I will put in bold and commenting the lines 2 and 3, this way: 

# "local" is for Unix domain socket connections only
# local   all             ualas                                     scram-sha-256
# local   replication     ualas                                     scram-sha-256
# IPv4 local connections:
host    all        all            0.0.0.0/0            scram-sha-256
host    all             ualas             127.0.0.1/32            scram-sha-256
host    replication     ualas             127.0.0.1/32            scram-sha-256
# IPv6 local connections:
host    all        all            ::1/0            scram-sha-256 
host    all             ualas             ::1/128                 scram-sha-256
host    replication     ualas             ::1/128                 scram-sha-256

The '0.0.0.0/0' and '::1/0' allows that any IP in the network can connect. This way you are going to be able to conect the Portal to the data base in order to make it work again.

Hope it can be helpful for you! 

Regards! 

0 Kudos
KPattison
Occasional Contributor

Hey UalasRohrer, 

We are getting this same error but when attempting to upgrade our Portal from 10.9.1 to 11.x.

Did you find a fix for this or were you able to identify a cause?

0 Kudos