# What is the node type for ml?

**URL:** <https://forum.opensearch.org/t/what-is-the-node-type-for-ml/15060>\
**Category:** OpenSearch\
**Created:** [July 12, 2023, 7:48am UTC](https://forum.opensearch.org/t/what-is-the-node-type-for-ml/15060 "2023-07-12T07:48:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cucukaka](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@cucukaka](https://forum.opensearch.org/u/cucukaka)\
**Post date:** [July 12, 2023, 7:48am UTC](https://forum.opensearch.org/t/what-is-the-node-type-for-ml/15060/1 "2023-07-12T07:48:28Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):  
opensearch 2.7.0

**Describe the issue** :  
According to these pages,  
[Creating a cluster - OpenSearch documentation](https://opensearch.org/docs/latest/tuning-your-cluster/index/)  
[About ML Commons - OpenSearch documentation](https://opensearch.org/docs/2.7/ml-commons-plugin/index/)  
node type for ml is dynamic or ml.  
so I gave the type for each node like this

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/6/6342bd0abfe2379122bd7058b0d98a79f0a3a0cc.png)  
but neither didn’t set ml role in node.role(both nodes follow “dir” - data, ingest, remote~)  
I want to configure a node with “ml” role.  
how to set in docker-compose.yml?

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [July 17, 2023, 11:16am UTC](https://forum.opensearch.org/t/what-is-the-node-type-for-ml/15060/2 "2023-07-17T11:16:30Z")

</div>

@cucukaka I had a look at the `node.role` in the older version and it was used until version 2.0.0.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/6/61e4b20f070d8600128c77bcdaa192d65def93a8.png)

In version 2.1.0, the new field `node.roles` has been introduced to support dynamic and ml node roles.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/f/f203aef424c40e5cbc9a51f2d6f16ac9de8c2655.png)

You should refer to `node.roles` from version 2.1.0 and onwards.

Please find more details in the OpenSearch 2.1.0 release notes.

> <https://github.com/opensearch-project/opensearch-build/blob/main/release-notes/opensearch-release-notes-2.1.0.md>

---

<div class="post-metadata">

**Author:** ![cucukaka](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@cucukaka](https://forum.opensearch.org/u/cucukaka)\
**Post date:** [July 21, 2023, 3:41am UTC](https://forum.opensearch.org/t/what-is-the-node-type-for-ml/15060/3 "2023-07-21T03:41:03Z")

</div>

which one is the “ml” roles in node between “dynamic” and “ml”?

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [July 21, 2023, 1:22pm UTC](https://forum.opensearch.org/t/what-is-the-node-type-for-ml/15060/4 "2023-07-21T13:22:05Z")

</div>

@cucukaka Sorry but I don’t get the question. Could you elaborate on that?

---

<div class="post-metadata">

**Author:** ![cucukaka](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@cucukaka](https://forum.opensearch.org/u/cucukaka)\
**Post date:** [July 24, 2023, 6:31am UTC](https://forum.opensearch.org/t/what-is-the-node-type-for-ml/15060/5 "2023-07-24T06:31:46Z")

</div>

yeah I mean,  
there is a “node.role” setting in docker-compose.yml when I configed opensearch cluster.  
In “node.roles” , Which of the two values of ml and dynamic really serves as **machine learning?**  
“ml” or “dymanic” or both? or does it matter what?

```auto
version: '3'
services:
  os-node:
    image: opensearchproject/opensearch:latest
    container_name: os-node
    environment:
      - cluster.name=os
      - node.name=os-node
      - node.roles="data", "ml", "dynamic"

```

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [July 24, 2023, 12:07pm UTC](https://forum.opensearch.org/t/what-is-the-node-type-for-ml/15060/6 "2023-07-24T12:07:40Z")

</div>

@cucukaka The node type list in the [OS documentation](https://opensearch.org/docs/2.7/ml-commons-plugin/index/) refers to the types of nodes and not the specific node role names.

According to this [PR](https://github.com/opensearch-project/OpenSearch/pull/3436), new functionality has been introduced in OS 2.1, which is called dynamic roles.  
What it means in practice is defining any role in the `node.roles` other than built-in (data, ingest, master, remote) will not fail the OpenSearch node startup process.

i.e.  
Defining custom roles in roles.mapping

```auto
 node.roles=cluster_manager,role1,role2,custom_role

```

will result with this output of the \_cat/nodes in OpenSearch 2.1+

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/5/5e31752b3e7bab84b2aedaa1cdfed728bf6df64b.png)

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/b/b3c6be9835816b999e717eda5cf765335e217cfd.png)

but it will fail in the older version as it doesn’t support dynamic (custom) roles.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/8/8075e0f4289de58c961aa44a575773ffb02c1e1b.png)

Regarding the Machine Learning role, as per the OS documentation, you should configure an `ml` role in the nodes.roles. Should, because it is not mandatory to have it configured.  
The `ml` role makes the node a dedicated node for ML functions and tasks. The ML plugin will first look for the nodes with `ml` role to route the tasks to that node. If there are no `ml` nodes configured in the cluster, the ML plugin will use data nodes instead.
