Submitting a Job on the FlinkSQL Client
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
- Log in to the node where the client is installed as the client installation user.
- Run the following command to go to the client installation directory:
cd /opt/hadoopclient
- Run the following command to initialize environment variables:
source /opt/hadoopclient/bigdata_env
- Log in to the FlinkSQL Client and submit a job.
- Start yarn-session by referring to Using Flink from Scratch and record yarn-session ID (yid).
yarn-session.sh -nm "session-name"
- Run the following command to access the FlinkSQL Client:
cd /opt/hadoopclient/Flink/flink/bin
./sql-client.sh
Figure 1 Accessing the FlinkSQL Client
- Set high-availability.cluster-id to the yarn-session ID.
SET high-availability.cluster-id=yarn-session ID;
- 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
- 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
- Start yarn-session by referring to Using Flink from Scratch and record yarn-session ID (yid).
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot