Slave nodes not in Yarn ResourceManager

Problem solved. Some configuration should be done in yarn-site.xml to let the nodemanager know where is the resource manager. Specifically, I added this property into yarn-site.xml:

  <property>
    <name>yarn.resourcemanager.hostname</name>
    <value>master</value>
  </property>

Reason: the default value in yarn-default.xml is 0.0.0.0, and many properties use this hostname to contact resource manager, such as

<property>
    <name>yarn.resourcemanager.address</name>
    <value>${yarn.resourcemanager.hostname}:8032</value>
</property>

Answer credits: https://stackoverflow.com/a/22125279/3209177