The command:
hdfs haadmin -getServiceState machine-98
Works only if you know the machine name. Is there any command like:
h
From java api, you can use HAUtil.getAddressOfActive(fileSystem).
HAUtil.getAddressOfActive(fileSystem)