Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#1. SSH on node
#2. Create or edit file /var/lib/dcos/mesos-slave-common
#3. Add contents as :
# MESOS_ATTRIBUTES=<key>:<value>
# Example:
#4. Stop dcos-mesos-slave service
# systemctl stop dcos-mesos-slave
#5. Remove link for latest slave metadata
# rm -f /var/lib/mesos/slave/meta/slaves/latest
#6. Start dcos-mesos-slave service
# systemctl start dcos-mesos-slave
#7. Wait for some time, node will be in HEALTHY state again.
#8. Add app placement constraint with field = key and value = value
#9. Verify attributes, run on any node
# curl -s http://leader.mesos:5050/state | jq '.slaves[]| .hostname ,.attributes'
# OR Check DCOS cluster UI
# Nodes => Select any Node => Details Tab
tmpScript=$(mktemp "/tmp/addDcosNodeAttributes-XXXXXXXX")
# key:value paired attribues, separated by ;
cat <<EOF > ${tmpScript}
echo "MESOS_ATTRIBUTES=${ATTRIBUTES}" | sudo tee /var/lib/dcos/mesos-slave-common
sudo systemctl stop dcos-mesos-slave
sudo rm -f /var/lib/mesos/slave/meta/slaves/latest
sudo systemctl start dcos-mesos-slave
# Add the private ip of nodes on which you want to add attrubutes, one ip per line.
for i in `cat nodes.txt`; do
echo $i
dcos node ssh --master-proxy --option StrictHostKeyChecking=no --private-ip $i <$tmpScript
sleep 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.