When creating a cluster, you can optionally upload one or more node recipes. Node Recipes are scripts which will be executed on specific node(s) before or after the cluster installation. You can use recipes for tasks such as installing additional software or performing advanced cluster configuration.
Writing Node Recipes
When using recipes, consider the following:
- The scripts will be executed on the node types you specify (such as "master", "worker", "compute"). If you want to run a a script on all nodes, define the recipe one per node type.
- The script will execute on all of the nodes of that type as
- In order to be executed, your script must be in a network location which is accessible from the cloud controller and cluster instances VPC.
- Make sure to follow Linux best practices when creating your scripts. For example, don't forget to script "Yes" auto-answers where needed.
- Do not execute
yum update –ysince it may update other components on the instances (such as
salt), which can create unintended or unstable behavior.
Adding Node Recipes
To add node recipes:
- Place your scripts in a network location accessible from the cloud controller and cluster instances VPC.
- Define the recipe when creating a cluster using the cloud controller UI or CLI.
For each recipe, you need to specify:
- The URL pointing to the script
- Whether to execute the script before ("pre-install") or after ("post-install") the Ambari cluster installation
- On which node type to execute the script ("master", "worker", "compute")
You can also add recipes through the CLI. For more information, refer to the Node Recpies section in the CLI documentation.
Executing Node Recipes
The scripts will be executed as
root. The recipe output is written
/var/log/recipes on each node on which it was exected.