PXF Installation

This guide describes how to install and configure PXF on a YMatrix cluster to access external data sources using the Platform Extension Framework (PXF) and Foreign Data Wrapper (FDW) mechanisms.

Note!
All of the following installation and configuration steps must be performed on all machines in the cluster.

Note!
The PXF feature is only supported in the Enterprise Edition. For more information, contact: [email protected].

System Requirements

  • PXF requires a Java 8 or Java 11 runtime environment, with the $JAVA_HOME environment variable correctly set.
  • The default installation path for the PXF RPM is /usr/local/pxf-matrixdb4.

Proceed with the following installation steps:

1. Install PXF

Note!
This step must be performed as the root user or a regular user with sudo privileges on all nodes.

Run the following command to install the RPM package:

$ sudo yum install -y pxf-matrixdb4-6.3.0-1.el7.x86_64.rpm

2. Configure Environment Variables

On all nodes, edit the /etc/profile file as the root user or a user with sudo privileges, and add the following content.

Note!
Replace JAVA_HOME with the actual path on the current machine.

$ vim /etc/profile
export PXF_HOME=/usr/local/pxf-matrixdb4
export PATH=$PXF_HOME/bin:$PATH
export JAVA_HOME=/usr/local/java/jdk1.8.0_181
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

After saving, reload the environment variables:

$ source /etc/profile

Edit the PXF environment configuration file:

$ vi /usr/local/pxf-matrixdb4/conf/pxf-env.sh

Ensure the following line is present or add it:

export JAVA_HOME=/usr/local/java/jdk1.8.0_181

3. Modify File Permissions and Copy Files

Note!
This step must be performed as the root user or a regular user with sudo privileges on all nodes.

Change the ownership of the PXF installation directory to mxadmin:

$ sudo chown -R mxadmin:mxadmin /usr/local/pxf-matrixdb4

Change the ownership of the FDW control file:

$ sudo chown mxadmin:mxadmin /opt/ymatrix/matrixdb6/share/postgresql/extension/pxf_fdw.control

Copy the shared library file to the target directory:

$ cp /usr/local/pxf-matrixdb4/fdw/pxf_fdw.so  /opt/ymatrix/matrixdb6/lib/postgresql/

4. Initialize PXF

After ensuring the cluster is running, log in to the Master node as the mxadmin user and run the following command:

$ pxf cluster register

A successful initialization displays output similar to the following (example: Master and two Segment nodes initialized successfully):

Initializing PXF on master host and 2 segment hosts...
PXF initialized successfully on 3 out of 3 hosts

5. Synchronize PXF Configuration from Master to All Segments

First, install rsync on all nodes as the root user or a user with sudo privileges:

$ sudo yum install -y rsync

On the Master node, run the following command as the mxadmin user to synchronize PXF configuration files across all cluster nodes:

$ pxf cluster sync

The following output indicates that the PXF configuration files have been synchronized successfully:

Syncing PXF configuration files from master host to 2 segment hosts...
PXF configs synced successfully on 2 out of 2 hosts

6. Start PXF

On the Master node, run the following command as the mxadmin user to start the PXF service:

$ pxf cluster start

The following output indicates that PXF has started successfully:

Starting PXF on 2 segment hosts...
PXF started successfully on 2 out of 2 hosts

7. Check PXF Status

On the Master node, run the following command as the mxadmin user to check the PXF status and ensure all nodes are running properly:

$ pxf cluster status

Confirm that the PXF cluster has started successfully:

Checking status of PXF servers on 2 segment hosts...
PXF is running on 2 out of 2 hosts