Using OmniAdvisor
Install OmniAdvisor to a specified directory on the management node, for example, /opt/OmniAdvisor, which is represented as $OMNIADVISOR_HOME. You can use OmniAdvisor in the OmniAdvisor CLI or through non-interactive commands. The OmniAdvisor CLI is recommended.
Using OmniAdvisor in the CLI
Using OmniAdvisor involves five steps: calling the OmniAdvisor entry, initializing the environment configuration, parsing historical task information, and using AI algorithms to sample and recommend parameters.
- Call the OmniAdvisor entry.
- Call the OmniAdvisor entry on the management node to start using the OmniAdvisor feature through the OmniAdvisor CLI.
python $OMNIADVISOR_HOME/BoostKit-omniadvisor_1.1.0/main.pyc
- Input the MySQL user password as prompted and press Enter.

- Select an engine to be tuned.
Input spark or hive, or press Tab to select an engine.

- Select a command to proceed.
- Execute the command to perform the target operation.
Table 1 Commands and corresponding operations Command
Operation
init_environment
Initializes the environment configuration, including database connection, database creation, and data table initialization.
fetch_history_data
Parses historical task information from the Spark history server or Hive timeline server.
parameter_sampling
Samples parameters of all historical tasks using AI algorithms.
parameter_recommend
Recommends parameters.
- Call the OmniAdvisor entry on the management node to start using the OmniAdvisor feature through the OmniAdvisor CLI.
- Initialize the environment configuration.
Input init_environment or press Tab to select init_environment, and then press Enter to initialize the environment.

- Parse historical task information.
Input fetch_history_data or press Tab to select fetch_history_data, and then press Enter to call the log parsing module to parse historical task information.

- Sample parameters using AI algorithms.
- Input parameter_sampling or press Tab to select parameter_sampling, and then input the number of sampling rounds as prompted.

- Choose whether to sample all tasks in the database. By default, all tasks in the database will be sampled and tuned. If you select no, select one or more tasks to be tuned.

- If you select no, the CLI lists all the tasks available for tuning. Copy the identification values of the tasks that you want to tune, separate them with commas (,), and press Enter to sample the parameters of these tasks.

- Input parameter_sampling or press Tab to select parameter_sampling, and then input the number of sampling rounds as prompted.
- Perform parameter recommendation.
Input parameter_sampling or press Tab to select parameter_sampling, input the SQL statement or application submission command to recommend parameters, and submit the recommended parameters to the engine for execution.

Using OmniAdvisor Through Non-interactive Commands
On the management node, you can use OmniAdvisor options to quickly perform target operations. See Table 2.
|
Option |
Description |
Example |
|---|---|---|
|
-e, --engine |
Big data engine to be tuned, which is Spark or Hive. |
python main.pyc -e spark |
|
-i, --instruction |
Operation to be performed, which can be init_environment, fetch_history_data, parameter_sampling, or parameter_recommend. |
python main.pyc -e spark -i init_environment |
|
-s, --sampling_id |
Sampling identifiers, which are separated by commas (,). |
python main.pyc -e spark -i parameter_sampling -s "xx1" |
|
-n, --sampling_count |
Number of parameter sampling rounds. |
python main.pyc -e spark -i parameter_sampling -n 10 |
|
-c, --cmd |
Spark or Hive submission command of the specified parameter recommendation task. |
python main.pyc -e spark -i parameter_recommend -c "spark-sql xxx" |
|
-v, --version |
Displays the OmniAdvisor version. |
python main.pyc -v |
|
--help |
Displays help information. |
python main.pyc --help |
- Initialize the environment.
python $OMNIADVISOR_HOME/BoostKit-omniadvisor_1.1.0/main.pyc -e spark -i init_environment
- Parse historical task information.
python $OMNIADVISOR_HOME/BoostKit-omniadvisor_1.1.0/main.pyc -e spark -i fetch_history_data
- Sample parameters.Example: Perform three rounds of parameter sampling on the tasks whose identification values are xx1 and xx2.
python $OMNIADVISOR_HOME/BoostKit-omniadvisor_1.1.0/main.pyc -e spark -i parameter_sampling -s "xx1,xx2" -n 3
- Perform parameter recommendation.
python $OMNIADVISOR_HOME/BoostKit-omniadvisor_1.1.0/main.pyc -e spark -i parameter_recommend -c "spark-sql xxx"
