A bootstrap action is a custom script executed when a cluster is created to help you modify the cluster environment, install third-party software, and use your own data.
An EMR instance can be created in the following steps:
A bootstrap action can be executed on the following three occasions:
A bootstrap action will run bootstrap scripts during cluster creation and scaling. Bootstrap scripts will be executed in sequence in the order of addition, and there can be up to 16 bootstrap actions.
Create a small pay-as-you-go cluster first to test whether the bootstrap action works properly, and if yes, create a production cluster.
Method 1. Add a bootstrap action when creating a cluster on the purchase page.
Select Basic Configuration > Advanced Settings > Add Bootstrap Action to add a bootstrap action.
You can edit or delete the added bootstrap action.
Select the running occasion and enter relevant parameters.
Name: you are recommended to keep it the same as your "object name".
Script Location: you are recommended to copy the location information on the COS details page. Enter the COS Console, click Bucket List, select the desired script, and select Operation > Details.
On the Details page, you can view the "Object Name" and "Object Address".
Parameter: this refers to the parameters for running the script. Separate multiple parameters by spaces, and do not add spaces in individual parameters. The total length of "Parameter" and "Name" cannot exceed 240 characters.
Method 2. Add a bootstrap action on the **Basic Info page of the cluster.**
Currently, you cannot specify a bootstrap action during scaling in the console. The bootstrap action specified during cluster creation will be executed during scaling.
If you want to specify a bootstrap action for scaling, use APIs to scale. If a bootstrap action is specified for scaling, it will be executed during scaling; otherwise, the one specified during cluster creation will be executed.
Logs and script files to be executed are stored in the
/usr/local/service/scripts/ directory. The script system log is
The scripts will be executed on all types of nodes, and the script files and output log files of script execution will be stored on each node.
Bootstrap script content needs to be encoded in UTF-8.