sudo -E -u hadoop /home/hadoop/bin/hdfs haadmin -getServiceState nn1
sudo -E -u hadoop /home/hadoop/bin/hdfs haadmin -getServiceState nn2
sudo -E 加大E是因为在sudo中默认是读不到环境变量的,例如$JAVA_HOME
sudo -E -u hadoop /home/hadoop/bin/hdfs haadmin -getServiceState nn1
sudo -E -u hadoop /home/hadoop/bin/hdfs haadmin -getServiceState nn2
sudo -E 加大E是因为在sudo中默认是读不到环境变量的,例如$JAVA_HOME