In this recipe, we will set different attributes for our agents. Attributes are extremely useful when our cluster is not homogeneous and we want to distinguish agents from each other.
Let's assume our cluster contains agents with SSD and HDD drives. Disk resources will unify SSD and HDD, but from the user's perspective they are different and some tasks need to be run on SSD. We can label agents with the disk attributes
ssd, depending on the disk type, hence allowing the user to decide which disk should be used for the job.
To create an attribute, we need to place the file in
/etc/mesos-slave/attributes. The following command will create this directory:
mkdir -p /etc/mesos-slave/attributes
The filename will be the attribute label and the content will be a value. To create the
disk:ssd attribute, simply create a file with the following contents: