PXF Installation

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

Notes!
Please make sure that all machines in the cluster perform the following operations to install and configure PXF.

Notes!
The PXF feature is only supported in Enterprise Edition. If you need it, please contact: [email protected].

Environmental Requirements

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

The installation steps are as follows:

1 Installation

Notes!
This step needs to be performed on all nodes using a root user or a normal user with sudo permissions.

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 using the root user or a user with sudo permissions, adding the following.

Notes!
JAVA_HOME needs to be replaced with the actual path of 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

Refresh environment variables after saving:

$ source /etc/profile

Edit PXF's environment configuration file

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

Confirm or add in the file

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

3 Modify file permissions and copy files

Notes!
This step needs to be performed on all nodes using a root user or a normal user with sudo permissions.

Change the permissions to the PXF installation directory to mxadmin.

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

Modify permissions to FDW control files:

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

Copy the shared library file to the directory:

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

4 Initialize PXF

After ensuring that the cluster is started, execute the following commands under the Master node as the mxadmin user:

$ pxf cluster register

After execution, the output is similar to the following information, indicating that the initialization is successful (example: Master and 2 Segment nodes are initialized successfully):

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

5 Synchronize PXF configuration files from Master to all segments

First, install rsync under all nodes** using root user or ordinary users with sudo permissions.

$ sudo yum install -y rsync

In Master, use the mxadmin user to execute the following commands to synchronize the PXF configuration file to all nodes of the cluster.

$ pxf cluster sync

As shown below, the PXF configuration file has 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

In Master, use the mxadmin user to execute the following command to start the PXF service.

$ pxf cluster start

As shown below, it is stated that PXF is started successfully.

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

7 Detect PXF status

In Master, use the mxadmin user to execute the following command to detect the PXF status to ensure that all nodes are operating properly.

$ pxf cluster status

Confirm that the PXF cluster starts successfully.

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