[ https://issues.apache.org/jira/browse/HDFS-8277?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14518968#comment-14518968 ]
surendra singh lilhore commented on HDFS-8277: ---------------------------------------------- In {{DFSAdmin.java}} class {{setSafeMode()}} API will iterate on NN proxy list and one by one set NN in safe mode. If first namenode connection is failed then it will come out from loop. {code} for (ProxyAndInfo<ClientProtocol> proxy : proxies) { ClientProtocol haNn = proxy.getProxy(); boolean inSafeMode = haNn.setSafeMode(action, false); if (waitExitSafe) { inSafeMode = waitExitSafeMode(haNn, inSafeMode); } System.out.println("Safe mode is " + (inSafeMode ? "ON" : "OFF") + " in " + proxy.getAddress()); } {code} Here we should catch the connection exception and continue for next NN. > Safemode enter fails when Standby NameNode is down > -------------------------------------------------- > > Key: HDFS-8277 > URL: https://issues.apache.org/jira/browse/HDFS-8277 > Project: Hadoop HDFS > Issue Type: Improvement > Components: ha, HDFS, namenode > Affects Versions: 2.6.0 > Environment: HDP 2.2.0 > Reporter: Hari Sekhon > Assignee: surendra singh lilhore > Priority: Minor > Attachments: HDFS-8277.patch > > > HDFS fails to enter safemode when the Standby NameNode is down (eg. due to > AMBARI-10536). > {code}hdfs dfsadmin -safemode enter > safemode: Call From nn2/x.x.x.x to nn1:8020 failed on connection exception: > java.net.ConnectException: Connection refused; For more details see: > http://wiki.apache.org/hadoop/ConnectionRefused{code} > This appears to be a bug in that it's not trying both NameNodes like the > standard hdfs client code does, and is instead stopping after getting a > connection refused from nn1 which is down. I verified normal hadoop fs writes > and reads via cli did work at this time, using nn2. I happened to run this > command as the hdfs user on nn2 which was the surviving Active NameNode. > After I re-bootstrapped the Standby NN to fix it the command worked as > expected again. > Hari Sekhon > http://www.linkedin.com/in/harisekhon -- This message was sent by Atlassian JIRA (v6.3.4#6332)