Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Change the port of Embedded postgresql after installation for Ambari server

Highlighted

Change the port of Embedded postgresql after installation for Ambari server

New Contributor

Hello ,

We have a 7 node HDP cluster with 3 management and 4 data nodes on RHEL7. We have installed the cluster using Ambari with embedded postgresql.

We want to update the default port of the DB from 5432 to some other ports. Till now we have updated

  1. Postgresql.conf
  2. postgresql.service
  3. ambari.properties jdbc url

However, I am getting error stating, check whether TCP/IP connections are being accepted by Postmaster. I am able to connect to the postgresql server using psql.

Please suggest where are are going wrong?

Thanks and regards

6 REPLIES 6

Re: Change the port of Embedded postgresql after installation for Ambari server

Super Mentor

@Adarsh Jaiswal

Do you see the following properties (liek Postrgres URL / Port) inside your ambari.properties? It will be there only if you are using External Postgres (instead of using Embedded Postgres).

If you are using external Postgres then in that case you can simply change the following properties to point to your new Postgres Server

#  grep 'jdbc' /etc/ambari-server/conf/ambari.properties 
server.jdbc.connection-pool=internal
server.jdbc.database=postgres
server.jdbc.database_name=ambari
server.jdbc.driver=org.postgresql.Driver
server.jdbc.hostname=standaloneambari1.example.com
server.jdbc.port=5432
server.jdbc.postgres.schema=ambari
server.jdbc.rca.driver=org.postgresql.Driver
server.jdbc.rca.url=jdbc:postgresql://standaloneambari1.example.com:5432/ambari
server.jdbc.rca.user.name=ambari
server.jdbc.rca.user.passwd=/etc/ambari-server/conf/password.dat
server.jdbc.url=jdbc:postgresql://standaloneambari1.example.com:5432/ambari
server.jdbc.user.name=ambari
server.jdbc.user.passwd=/etc/ambari-server/conf/password.dat

.

Like server.jdbc.port, server.jdbc.url

Then start ambari server.

# ambari-server start

.

Re: Change the port of Embedded postgresql after installation for Ambari server

New Contributor

We I only see the following properties:

server.jdbc.connection-pool=internal
server.jdbc.database=postgres
server.jdbc.database_name=ambari
server.jdbc.postgres.schema=ambari
server.jdbc.user.name=ambari
server.jdbc.user.passwd=<filepath>


Re: Change the port of Embedded postgresql after installation for Ambari server

Super Mentor

@Adarsh Jaiswal

If you are using Embedded mode and if you want to change the port then you can also run the ambari-server setup command and this time choose option "[4] - PostgreSQL" (instead of using [1] - PostgreSQL (Embedded))

But before doing that please make sure to collect a fresh Database Dump:

1. Collect latest Db dump (for backup)

# pg_dump -U ambari ambari > /PATH/TO/ambari_db_dump.sql

2. Now run the ambari-server setup command and choose option 4.

# ambari-server setup
Using python  /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'enabled'
SELinux mode is 'permissive'
WARNING: SELinux is set to 'permissive' mode and temporarily disabled.
OK to continue [y/n] (y)? y
Customize user account for ambari-server daemon [y/n] (n)? 
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
Do you want to change Oracle JDK [y/n] (n)? n
Checking GPL software agreement...
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? y
Configuring database...
==============================================================================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL / MariaDB
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
[7] - BDB
==============================================================================
Enter choice (1): 4

Hostname : dbhost.example.com
Port (5432): 5555
Database name (ambari): ambari
Postgres schema (ambari): ambari
Username (ambari): ambari
Enter Database Password (bigdata): bigdata

.

3. Start Ambari Server

Re: Change the port of Embedded postgresql after installation for Ambari server

New Contributor

Wouldn't that end up in losing all the configurations in the cluster? Or do I have to restore the backup?

Also, we have ldap setup for user authentication. Would that mean that we have to re configure the ldap settings as well ?

Re: Change the port of Embedded postgresql after installation for Ambari server

Explorer

Hello @jsensharma , Please tell me the difference between Embedded mode and the other mode ?

Re: Change the port of Embedded postgresql after installation for Ambari server

Super Mentor

@Adarsh Jaiswal

If you still get the error then please post the complete stacktrace from ambari-server.log

Also please verify if the postgres server has opened the desired port?

# netstat -tnlpa | grep postgres

.

Also please share the output of the grep command:

#  grep 'jdbc' /etc/ambari-server/conf/ambari.properties 

.

Please verify if you are able to connect to Postgres DB using the following command or not?

# psql -U ambari ambari 
Password for user ambari: bigdata

If you are not able to connect to Postgres DB using the psql utility as well means there is something wrong with your Postgres configuration, In that case please check and share the postgres conf (/var/lib/pgsql/data/pg_hba.conf and /var/lib/pgsql/data/pg_log/*)

.

Don't have an account?
Coming from Hortonworks? Activate your account here