You can submit programs developed by yourself to MRS to execute them, and obtain the results. This section describes how to submit a HiveSQL job on the MRS management console. HiveSQL jobs are used to submit SQL statements and script files for data query and analysis. Both SQL statements and scripts are supported. If SQL statements contain sensitive information, use Script to submit them.
You have uploaded the program packages and data files required for running jobs to OBS or HDFS.
In the Basic Information area on the Dashboard page, click Synchronize on the right side of IAM User Sync to synchronize IAM users. For details, see Synchronizing IAM Users to MRS.
Parameter |
Description |
---|---|
Name |
Job name. It contains 1 to 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. NOTE:
You are advised to set different names for different jobs. |
SQL Type |
Submission type of the SQL statement
|
SQL Statement |
This parameter is valid only when SQL Type is set to SQL. Enter the SQL statement to be executed, and then click Check to check whether the SQL statement is correct. If you want to submit and execute multiple statements at the same time, use semicolons (;) to separate them. |
SQL File |
This parameter is valid only when SQL Type is set to Script. The path of the SQL file to be executed must meet the following requirements:
NOTE:
For MRS 1.9.2 or later: A file path on OBS can start with obs://. To submit jobs in this format, you need to configure permissions for accessing OBS.
|
Program Parameter |
(Optional) Used to configure optimization parameters such as threads, memory, and vCPUs for the job to optimize resource usage and improve job execution performance. Table 2 describes the common parameters of a running program. |
Service Parameter |
(Optional) It is used to modify service parameters for the job. The parameter modification applies only to the current job. To make the modification take effect permanently for the cluster, follow instructions in Configuring Service Parameters. To add multiple parameters, click Table 3 lists the common service configuration parameters. |
Command Reference |
Command submitted to the background for execution when a job is submitted. |
Parameter |
Description |
Example Value |
---|---|---|
--hiveconf |
Hive service configuration, for example, set the execution engine to MapReduce. |
Setting the execution engine to MR: --hiveconf "hive.execution.engine=mr" |
--hivevar |
Custom variable, for example, variable ID. |
Setting the variable ID: --hivevar id="123" select * from test where id = ${hivevar:id} |
Parameter |
Description |
Example Value |
---|---|---|
fs.obs.access.key |
Key ID for accessing OBS. |
- |
fs.obs.secret.key |
Key corresponding to the key ID for accessing OBS. |
- |
hive.execution.engine |
Engine for running a job. |
|
Parameter |
Description |
---|---|
Name |
Job name. It contains 1 to 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. NOTE:
You are advised to set different names for different jobs. |
Program Path |
Path of the program package to be executed. The following requirements must be met:
|
Parameters |
Key parameter for program execution. The parameter is specified by the function of the user's program. MRS is only responsible for loading the parameter. Multiple parameters are separated by space. Configuration method: Package name.Class name The parameter contains a maximum of 150,000 characters. It cannot contain special characters ;|&><'$, but can be left blank. NOTE:
When entering a parameter containing sensitive information (for example, login password), you can add an at sign (@) before the parameter name to encrypt the parameter value. This prevents the sensitive information from being persisted in plaintext. When you view job information on the MRS management console, the sensitive information is displayed as *. Example: username=admin @password=admin_123 |
Import From |
Path for inputting data Data can be stored in HDFS or OBS. The path varies depending on the file system.
The parameter contains a maximum of 1,023 characters, excluding special characters such as ;|&>,<'$, and can be left blank. |
Export To |
Path for outputting data NOTE:
Data can be stored in HDFS or OBS. The path varies depending on the file system.
The parameter contains a maximum of 1,023 characters, excluding special characters such as ;|&>,<'$, and can be left blank. |
Log Path |
Path for storing job logs that record job running status. Data can be stored in HDFS or OBS. The path varies depending on the file system.
The parameter contains a maximum of 1,023 characters, excluding special characters such as ;|&>,<'$, and can be left blank. |
After the job is created, you can manage it.
source /opt/BigData/client/bigdata_env
kinit MRS cluster user (The user must be in the hive user group.)
beeline
For clusters in normal mode, run the following commands. If no component service user is specified, the current OS user is used to log in to the HiveServer.
beeline -n Component service user
beeline -f SQL files (SQLs in the execution files)