Updated on 2024-08-10 GMT+08:00

Configuring the Python3 Sample Project

This section applies to MRS 3.3.0 or later.

Scenario

The following content describes the operations you need to do to run the pyhon3 sample code of HetuEngine on FusionInsight MRS.

Procedure

  1. Install Python 3.6 or a later version (before 3.9) on the client node.

    The Python version can be viewed by running the python3 command on the CLI of the client. The following information indicates that the Python version is 3.8.2.
    Python 3.8.2 (default, Jun 23 2020, 10:26:03)
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
    Type "help", "copyright", "credits" or "license" for more information.     

  2. Setuptools must be installed on the client.

    Download the software from the official website https://pypi.org/project/setuptools/#files.

    Copy the downloaded setuptools package to the client, decompress the package, go to the setuptools project directory, and run the python3 setup.py install command in the CLI of the client.

    Take version 47.3.1 as an example, the following information indicates that setuptools 47.3.1 is installed successfully.

    Finished processing dependencies for setuptools==47.3.1     

    If the system displays a message indicating that setuptools 47.3.1 fails to be installed, check whether the environment is faulty or Python is faulty.

  3. The JayDeBeApi module must be installed on the client. You can use the Java JDBC to connect to the database through this module.

    You can install it either of the following ways:
    • pip:

      Run the pip install JayDeBeApi command on the client node.

    • Script:
      1. Download the JayDeBeApi project file from the official website at https://pypi.org/project/JayDeBeApi/
      2. Go to the JayDeBeApi project directory and run the python3 setup.py install command. During the installation, if the system displays a message indicating that the python3 module or package is missing, you need to add the module or package.

        Take JayDeBeApi-1.2.3 as an example. If Successfully installed JayDeBeApi-1.2.3 is displayed, the installation is successful.

  4. Install Java on the client. For details about the supported Java versions, see "JDK Installation" in the Table 1.
  5. Obtain the Python3 sample code.

    1. Obtain the sample project folder python3-examples in the src\hetu-examples directory where the sample code is decompressed. For details, see Obtaining the MRS Application Development Sample Project.
    2. Go to the python3-examples folder.
      • normal folder: Python3 sample code for interconnecting with HetuEngine in common mode
      • security folder: Python3 sample code for interconnecting with HetuEngine in security mode

  6. Obtain the hetu-jdbc JAR package.

    • Download the client file to the local PC through Manager.
      1. Log in to FusionInsight Manager and choose Cluster > Services > HetuEngine > More > Download Client.
      2. Select Complete Client, select the correct platform type (x86_64 for x86 and aarch64 for ARM) for the node where the client is to be installed, deselect Save to Path, and click OK. Wait until the client file package is generated and download it.
      3. Decompress the downloaded software package to obtain the hetu-jdbc package and decompress it to obtain the JDBC package.

        For example, if the client file package is FusionInsight_Cluster_1_Services_Client.tar, decompress the package to obtain the FusionInsight_Cluster_1_Services_ClientConfig.tar file. Then decompress the package to obtain the FusionInsight_Cluster_1_Services_ClientConfig file. (The path cannot contain spaces.) Decompress \FusionInsight_Cluster_1_Services_ClientConfig\HetuEngine\x86\hetu-jdbc.tar.gz to obtain hetu-jdbc-XXX.jar and copy it to the user-defined path on the host where the sample code will run.

    • Obtain the cluster client node.

      Log in to the node where the HetuEngine client has been installed. For example, if the client installation path is /opt/hadoopclient, obtain hetu-jdbc-XXX.jar from /opt/hadoopclient/HetuEngine/hetuserver/jars/, and copy the file to the user-defined path on the node where the sample code will run.