Changing the default Greenplum database port

Greenplum Database comes configured with the default master port of 5432. Administrators should follow this process to change the master port number. Perform these steps on your Greenplum master host. 

1.Shut down your Greenplum system in fast mode, interrupting and rolling back any active transactions. There cannot be active queries in the system when the system configuration is being altered.

$ gpstop -M fast

2.Edit the postgresql.conf file of the master. For example:

$ vi $MASTER_DATA_DIRECTORY/postgresql.conf

3.Change the following parameter to the new port number. For example if the new port is 54321:


Note: If you have a standby master host, you must also edit the $MASTER_DATA_DIRECTORY/postgresql.conf file on your standby master host. After you are finished, return to your primary master host to complete the process. 

4.Restart your Greenplum Database system.

$ gpstart

5.Start a psql client session using the new port and edit the gp_segment_configuration system catalog to change the master port. For example, if the new port is 54321 and the old port is 5432: psql -p 54321 -c "UPDATE gp_segment_configuration SET port=54321 WHERE port=5432"

6.Make sure that any client programs you are using are updated to connect to the new master port. For example, if using psql update the $PGPORT environment variable in the profile of your Greenplum superuser (gpadmin).

To confirm new port settings: Viewing Settings of Server Configuration Parameters

The SHOW SQL command allows you to see the settings of the server configuration parameters used by the Greenplum Database system. For example, to see the settings for all parameters:

$ psql -c 'SHOW ALL;'

Running SHOW will show the settings for the master instance only. If you want to see the value of a particular parameter across the entire system (master and all segments), you can use the gpconfig utility. For example: $ gpconfig --show max_connections