How to change the IP addresses in a GPDB Cluster
search cancel

How to change the IP addresses in a GPDB Cluster

book

Article ID: 440740

calendar_today

Updated On:

Products

VMware Tanzu Data Suite VMware Tanzu Greenplum VMware Tanzu Greenplum / Gemfire

Issue/Introduction

Periodically users will need to update/change the IP addresses for their GPDB cluster. This guide provides steps to safely change the GPDB cluster's IP address. 

 

Environment

GPDB: 6.x, 7.x 

Resolution

1. Check Current Configuration: 

- Log in as the gpadmin user and confirm the cluster relies on IP addresses or hostnames. In your case, the address column contains hostnames, so you only need to change the OS-level IPs and update /etc/hosts or DNS.

select * from gp_segment_configuration; 

 

2. Verify the Cluster Health: 

- Ensure the cluster is fully synchronized and healthy before starting. Do not attempt this on a degraded cluster.

3. Backup your databases, pg_hba.conf, postgresql.conf and /etc/hosts files. 

 

3.1 Take a full backup of your databases (or at least a metadata/schema backup) using gpbackup.

3.2 Make a copy of your pg_hba.conf and postgresql.conf files from the Master Data Directory. 

3.3 Make a copy of the /etc/hosts file from all nodes (master, standby master, and segment hosts).

 

4. Stop the Greenplum Cluster: 

-  gpstop -M fast

 

5. Update the OS and Network configurations. 

- Change the Network Interface IPs by Updating your OS network configuration files (e.g., /etc/sysconfig/network-scripts/ifcfg-eth0

6: Update the /etc/hosts files on every host (master, standby master, and segment hosts) 

- Modify the /etc/hosts file on every single node in the cluster to map the existing hostnames to the new IP addresses.


7. Restart Network Services:

- Restart the network service on all hosts or reboot the machines to apply the new IPs.


8. Remove SSH known hosts entries associated with the old IP addresses. 

- Because the IPs associated with the hostnames have changed, SSH strict host key checking might fail. On the master node (as gpadmin), clear the old entries:


9. Re-exchange SSH Keys:

gpssh-exkeys -f /path/to/hostfile_all

 

10. Update the pg_hba.conf across the cluster:

  • Master and Standby Master: If your new IP addresses are on a different subnet, update the client authentication file on the Master (and Standby Master) to allow connections from the new IPs.

  • Segment Hosts (Primary and Mirror): The pg_hba.conf files on every segment host must also be updated to reflect the new IP addresses. Edit the file on each segment to update the entries for:

    • The Master IP address

    • The Primary segment host IP address

    • The Mirror segment host IP address

  

11. Start the cluster and ensure all segments are online. 

- gpstart -a 

- gpstate -s