Example: Cluster template and custom properties JSON

Refer to the following example when creating a cluster template and custom properties JSON.

Example blueprint

Use the following example to create a template cluster template for setting custom properties.

When preparing the cluster template:

  • Use the mustache format. Data Hub supports mustache kind of templating with {{{ }}} syntax.
  • Include the templates in the “configurations” section of your cluster template.

The following example provides a template for setting three properties:

  • fs.trash.interval
  • hadoop.tmp.dir
  • hive.exec.compress.output
...
{
  "core-site": {
    "fs.trash.interval": "{{{ fs.trash.interval }}}",
    "hadoop.tmp.dir": "{{{ my.tmp.directory }}}"
  }
},
{
  "hive-site": {
    "hive.exec.compress.output": "{{{ hive.exec.compress.output }}}"
  }
},
...

Example properly value custom properties JSON

Use the following example to create a JSON template for setting custom properties.

The following JSON entry sets the values for the properties added to the cluster template mentioned in the previous section:
{
  "fs.trash.interval": "4320",
  "hive.exec.compress.output": "true",
  "my.tmp.directory": "/hadoop/tmp"
 }

In the cluster creation phase, the property values in the cluster template will be replaced based on the input, picking up the parameter values that you provided. As a result, the values of hive.exec.compress.output, my.tmp.directory, and fs.trash.interval will be replaced in the cluster template based on the input that you provided.

The property values will be replaced for the cluster as follows:

...
{
  "core-site": {
    "fs.trash.interval": "4320",
    "hadoop.tmp.dir": "/hadoop/tmp"
  }
},
{
  "hive-site": {
    "hive.exec.compress.output": "true"
  }
},
...