Updated on 2024-05-29 GMT+08:00

Submitting a Job on the FlinkSQL Client

This section applies to MRS 3.3.0 or later.

Scenario

This section describes how to use FlinkSQL Client to submit jobs.

Prerequisites

  • Flink has been installed in the MRS cluster and all components in the cluster are running properly.
  • The cluster client has been installed, for example, in /opt/hadoopclient.

Procedure

  1. Log in to the node where the client is installed as the client installation user.
  2. Run the following command to go to the client installation directory:

    cd /opt/hadoopclient

  3. Run the following command to initialize environment variables:

    source /opt/hadoopclient/bigdata_env

  4. Log in to the FlinkSQL Client and submit a job.

    1. Start yarn-session by referring to Using Flink from Scratch and record yarn-session ID (yid).

      yarn-session.sh -nm "session-name"

    2. Run the following command to access the FlinkSQL Client:

      cd /opt/hadoopclient/Flink/flink/bin

      ./sql-client.sh

      Figure 1 Accessing the FlinkSQL Client
    3. Set high-availability.cluster-id to the yarn-session ID.

      SET high-availability.cluster-id=yarn-session ID;

    1. Run the following SQL statement. If the execution is successful, the following information is displayed on the console.

      SELECT name, COUNT(*) AS cnt FROM ( VALUES ('Bob'), ('Alice'), ('Greg'), ('Bob') ) AS NameTable(name) GROUP BY name;

      Figure 2 Execution result
    2. View the executed job on Yarn.

      Log in to FusionInsight Manager, choose Cluster > Services > Yarn > Dashboard, and click the link next to ResourceManager WebUI to go to the Yarn web UI and view the job.

      Figure 3 Job