How To Resolve Postgres Ident Authentication for "tamr" User Issue?

Problem: While starting tamr, it gives the error FATAL: Ident authentication failed for user "tamr" as shown below:

Starting unify-all on port 9100 with pid 14149

Will ping unify-all with 50 retries (configurable with TAMR_SERVICES_START_UP_NUMBER_OF_RETRIES) and 6 seconds (configurable with TAMR_SERVICES_START_UP_RETRY_INTERVAL_SECONDS) between each retry.

Failed to start unify-all, printing logs & halting

==> /var/data/tamr/tamr/logs/unify-all.error.log <==

            ... 10 more

Caused by: org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user "tamr"

            at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(

            at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(

            at org.postgresql.core.ConnectionFactory.openConnection(

            at org.postgresql.jdbc.PgConnection.<init>(

            at org.postgresql.Driver.makeConnection(

            at org.postgresql.Driver.connect(

            at org.flywaydb.core.internal.util.jdbc.DriverDataSource.getConnectionFromDriver(

            ... 17 more

==> /var/data/tamr/tamr/logs/unify-all.out.log <==

Cause: This may happen when an incorrect authentication method is used in pg_hba.conf file (Postgres Configuration file).

Resolution: To resolve the issue, take the following steps:

Step 1: Update the pg_hba.conf for IPv4 and IPv6 with authentication method as shown below

# IPv4 local connections:

host    all             all               md5

# IPv6 local connections:

host    all             all             ::1/128                 md5

Step 2: Restart the database.

sudo systemctl restart postgresql-12.service