In this recipe, we will define roles and assign them weights to prioritize some frameworks over others.
Roles are part of the resources definition. We define resources and roles for each agent. For example, we want to change the default port range to
51000-52000 and the offered disk space to
4096 GB. To do this, we need to explicitly override the default values. You need to edit
/etc/mesos-slave/resources and put the desired resources:
echo 'disk(*):4096; ports(*):[51000-52000]'> /etc/mesos-slave/resources
In a similar way, we can define other resources such as CPUs, memory, or GPUs just by adding the corresponding entry. The preceding configuration defines the default roles -
To assign the resource to a specific role, put the role name after the resource in brackets. For example, we want to run role development and test on one cluster. We want to distinguish ports offered to these roles. The development tasks will be run on ports