Build whpg-pxf from source, then distribute the build to every host in your WarehousePG (WHPG) cluster, including the coordinator, standby coordinator, and all segment hosts. To move to a newer PXF version later, see Upgrading PXF.
Prerequisites
- Build host: GCC,
make,unzip,git, a cURL development package (libcurl-develon RHEL; use a version from source instead if you're on an older OS whose package only provides cURL 7.19), Go 1.21.3 or later, and JDK 8 or 11. Building directly on the WarehousePG coordinator avoids a cross-compile step, since it's already running the same OS as your segment hosts. - Every host in the cluster: JDK 8 or 11 to run. The PXF service is a Java process that runs on every host, not only the one you build on.
- WarehousePG installed on every host in the cluster, running on RHEL 7, 8, or 9.
Building from source
Build PXF on the coordinator, from the release-6.x branch. This branch is the PXF 6.x line, which supports WHPG 6 and 7.
Clone the repository and check out the
release-6.xbranch:bashgit clone https://github.com/warehouse-pg/whpg-pxf.git cd whpg-pxf git checkout release-6.xSet
JAVA_HOME, and source your WarehousePG environment so the build can find it:bashexport JAVA_HOME=<path-to-your-jdk> source /usr/local/greenplum-db/greenplum_path.shBuild PXF:
bashmakeThis command compiles the PXF service, the
pxfandpxf clusterCLI, and the WHPG extension.
Installing on the cluster
Set
GPHOME,PXF_HOME, andPXF_BASE, then install the build locally on the coordinator:bashexport GPHOME=/usr/local/greenplum-db export PXF_HOME=/usr/local/pxf export PXF_BASE=$HOME/pxf-base sudo mkdir -p "$PXF_HOME" sudo chown -R gpadmin:gpadmin "$GPHOME/" "$PXF_HOME" make installNote
The trailing slash after
$GPHOMEmatters. If$GPHOMEis a symbolic link,chownwithout the slash changes only the link, somake installfails withPermission denied.make installruns PXF's unit tests, then places the PXF service and CLI under$PXF_HOME, and copies the WHPG extension's control, SQL, and shared library files under$GPHOMEon the coordinator. If you don't setPXF_BASE, it defaults toPXF_HOME, and a later PXF upgrade can delete your server configurations along with it, so always set it to a separate directory.Create a file
all_hostslisting the coordinator, standby coordinator, and all segment hosts:inicdw scdw sdw1 sdw2 sdw3On WHPG 6, also create a file
other_hostslisting every host except the one you build on:iniscdw sdw1 sdw2 sdw3Create
$PXF_HOMEon every host, owned bygpadmin, then copy the built directory to the hosts you didn't build on. The directory must exist before the copy, becausegpadmincan't create it under/usr/local.On WHPG 7:
bashgpssh -f all_hosts -e "sudo mkdir -p $PXF_HOME && sudo chown -R gpadmin:gpadmin $PXF_HOME" gpsync -a -f all_hosts $PXF_HOME/ =:$PXF_HOMEOn WHPG 6:
bashgpssh -f other_hosts -e "sudo mkdir -p $PXF_HOME && sudo chown -R gpadmin:gpadmin $PXF_HOME" gpscp -r -f other_hosts $PXF_HOME =:$(dirname $PXF_HOME)Note
The trailing slash after
$PXF_HOMEin thegpsynccommand matters. Without it, the files land in$PXF_HOME/pxfinstead of$PXF_HOME.Copy the WHPG extension files from the coordinator to the same location under
$GPHOMEon every host you didn't build on, sincemake installinstalls them on the coordinator only. Make$GPHOMEwritable bygpadminon each host first.On WHPG 7:
bashgpssh -f all_hosts -e "sudo chown -R gpadmin:gpadmin $GPHOME/" gpsync -a -f all_hosts $GPHOME/lib/postgresql/pxf.so =:$GPHOME/lib/postgresql/ gpsync -a -f all_hosts $GPHOME/share/postgresql/extension/pxf.control $GPHOME/share/postgresql/extension/pxf--*.sql =:$GPHOME/share/postgresql/extension/On WHPG 6:
bashgpssh -f other_hosts -e "sudo chown -R gpadmin:gpadmin $GPHOME/" gpscp -f other_hosts $GPHOME/lib/postgresql/pxf.so =:$GPHOME/lib/postgresql/ gpscp -f other_hosts $GPHOME/share/postgresql/extension/pxf.control $GPHOME/share/postgresql/extension/pxf--*.sql =:$GPHOME/share/postgresql/extension/Note
pxf cluster registerdoesn't copy these files for a build from source.
Upgrading PXF
Upgrade PXF by building the new version and installing it over the existing one on every host. Because $PXF_BASE is separate from $PXF_HOME, your configuration and server definitions stay in place.
On the coordinator, record your current PXF version:
bashpxf versionStop PXF on every host:
bashpxf cluster stopBack up
$PXF_BASEon every host, so you can restore your configuration if needed. Each host holds its own copy of files thatpxf cluster syncdoesn't distribute, such as the keytabs:bashgpssh -f all_hosts -e "cp -a $PXF_BASE $PXF_BASE.bak.$(date +%Y%m%d)"To restore, replace
$PXF_BASEwith the$PXF_BASE.bak.<date>backup on each host.Build the new version and install it on the cluster, following Building from source and Installing on the cluster. Use the same
$PXF_HOMEand$PXF_BASElocations as your current installation.Sync the PXF configuration to every host:
bashpxf cluster syncThis command doesn't distribute
$PXF_BASE/keytabs. If you use Kerberos, confirm the keytab files are still in place on every host.Start PXF on every host:
bashpxf cluster start pxf cluster statusConfirm that every host runs the new version.
pxf versionreports only the version of thepxfcommand on the host where you run it, so query the running service on each host instead:bashgpssh -f all_hosts -e "curl -s http://localhost:5888/actuator/info"In each database that uses PXF, update the extension:
sqlALTER EXTENSION pxf UPDATE;
Next steps
See Configuring and starting PXF to set up and start the PXF service across your cluster. See PXF release notes for the changes in each PXF version.
