<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Switch NameNode HA  Zookeeper access from no security to SASL in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Switch-NameNode-HA-Zookeeper-access-from-no-security-to-SASL/m-p/167592#M29698</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/3209/zhuwchicago.html" nodeid="3209"&gt;@ScipioTheYounger&lt;/A&gt;, as described in the document you linked, you'd want to change ha.zookeeper.acl in core-site.xml to this:&lt;/P&gt;&lt;PRE&gt;&amp;lt;property&amp;gt;
    &amp;lt;name&amp;gt;ha.zookeeper.acl&amp;lt;/name&amp;gt;
    &amp;lt;value&amp;gt;sasl:nn:rwcda&amp;lt;/value&amp;gt;
&amp;lt;/property&amp;gt;&lt;/PRE&gt;&lt;P&gt;Then, you'd want to run the following to reformat ZooKeeper for NameNode HA, which would reinitialize the znode used by NameNode HA to coordinate automatic failover.&lt;/P&gt;&lt;PRE&gt;hdfs zkfc -formatZK -force&lt;/PRE&gt;&lt;P&gt;The tricky part, as you noticed, is getting that command to authenticate with SASL.  The &lt;A href="https://cwiki.apache.org/confluence/display/ZOOKEEPER/Zookeeper+and+SASL"&gt;ZooKeeper and SASL&lt;/A&gt; guide in the Apache documentation discusses implementation and configuration of SASL in ZooKeeper in detail.  For this particular command, you can use this procedure.&lt;/P&gt;&lt;P&gt;First, create a JAAS configuration file at /etc/hadoop/conf/hdfs_jaas.conf:&lt;/P&gt;&lt;PRE&gt;Client {
  com.sun.security.auth.module.Krb5LoginModule required
  useKeyTab=true
  storeKey=true
  useTicketCache=false
  keyTab="/etc/security/keytabs/nn.service.keytab"
  principal="nn/&amp;lt;HOST&amp;gt;@EXAMPLE.COM";
};&lt;/PRE&gt;&lt;P&gt;Note that the &amp;lt;HOST&amp;gt; will be different depending on the NameNode hostnames in your environment.  Likewise, you'll need to change EXAMPLE.COM to the correct Kerberos realm.&lt;/P&gt;&lt;P&gt;Next, edit /etc/hadoop/conf/hadoop-env.sh, and add the following line to enable SASL when running the zkfc command.&lt;/P&gt;&lt;PRE&gt;export HADOOP_ZKFC_OPTS="-Dzookeeper.sasl.client=true -Dzookeeper.sasl.client.username=zookeeper -Djava.security.auth.login.config=/etc/hadoop/conf/hdfs_jaas.conf -Dzookeeper.sasl.clientconfig=Client ${HADOOP_ZKFC_OPTS}"&lt;/PRE&gt;&lt;P&gt;Then, run the "hdfs zkfc -formatZK -force" command.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jun 2016 13:02:18 GMT</pubDate>
    <dc:creator>cnauroth</dc:creator>
    <dc:date>2016-06-13T13:02:18Z</dc:date>
    <item>
      <title>Switch NameNode HA  Zookeeper access from no security to SASL</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Switch-NameNode-HA-Zookeeper-access-from-no-security-to-SASL/m-p/167591#M29697</link>
      <description>&lt;P&gt;My cluster NN HA was implemented w/o securing the access to ZK. I am following the document to enable SASL: &lt;A href="https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.2/bk_installing_manually_book/content/hdfs_configuration.html" target="_blank"&gt;https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.2/bk_installing_manually_book/content/hdfs_configuration.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here is the existing Znode used by Hadoop NN for HA. I was ablet to  setACL on /hadoop-ha to sasl:nn:rwcda, but haadmin failover command failed.&lt;/P&gt;&lt;P&gt;[zk: zkserver1:2181(CONNECTED) 5] getAcl /hadoop-ha&lt;/P&gt;&lt;P&gt;'world,'anyone&lt;/P&gt;&lt;P&gt;: cdrwa&lt;/P&gt;&lt;P&gt;If I delete the old one, will NN automatically create a new Znode? &lt;/P&gt;&lt;P&gt;I also tried to do "hdfs zkfc -formatZK" to create a new one, but the command was not using SASL. &lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 01:26:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Switch-NameNode-HA-Zookeeper-access-from-no-security-to-SASL/m-p/167591#M29697</guid>
      <dc:creator>ScipioTheElder</dc:creator>
      <dc:date>2016-05-26T01:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: Switch NameNode HA  Zookeeper access from no security to SASL</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Switch-NameNode-HA-Zookeeper-access-from-no-security-to-SASL/m-p/167592#M29698</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/3209/zhuwchicago.html" nodeid="3209"&gt;@ScipioTheYounger&lt;/A&gt;, as described in the document you linked, you'd want to change ha.zookeeper.acl in core-site.xml to this:&lt;/P&gt;&lt;PRE&gt;&amp;lt;property&amp;gt;
    &amp;lt;name&amp;gt;ha.zookeeper.acl&amp;lt;/name&amp;gt;
    &amp;lt;value&amp;gt;sasl:nn:rwcda&amp;lt;/value&amp;gt;
&amp;lt;/property&amp;gt;&lt;/PRE&gt;&lt;P&gt;Then, you'd want to run the following to reformat ZooKeeper for NameNode HA, which would reinitialize the znode used by NameNode HA to coordinate automatic failover.&lt;/P&gt;&lt;PRE&gt;hdfs zkfc -formatZK -force&lt;/PRE&gt;&lt;P&gt;The tricky part, as you noticed, is getting that command to authenticate with SASL.  The &lt;A href="https://cwiki.apache.org/confluence/display/ZOOKEEPER/Zookeeper+and+SASL"&gt;ZooKeeper and SASL&lt;/A&gt; guide in the Apache documentation discusses implementation and configuration of SASL in ZooKeeper in detail.  For this particular command, you can use this procedure.&lt;/P&gt;&lt;P&gt;First, create a JAAS configuration file at /etc/hadoop/conf/hdfs_jaas.conf:&lt;/P&gt;&lt;PRE&gt;Client {
  com.sun.security.auth.module.Krb5LoginModule required
  useKeyTab=true
  storeKey=true
  useTicketCache=false
  keyTab="/etc/security/keytabs/nn.service.keytab"
  principal="nn/&amp;lt;HOST&amp;gt;@EXAMPLE.COM";
};&lt;/PRE&gt;&lt;P&gt;Note that the &amp;lt;HOST&amp;gt; will be different depending on the NameNode hostnames in your environment.  Likewise, you'll need to change EXAMPLE.COM to the correct Kerberos realm.&lt;/P&gt;&lt;P&gt;Next, edit /etc/hadoop/conf/hadoop-env.sh, and add the following line to enable SASL when running the zkfc command.&lt;/P&gt;&lt;PRE&gt;export HADOOP_ZKFC_OPTS="-Dzookeeper.sasl.client=true -Dzookeeper.sasl.client.username=zookeeper -Djava.security.auth.login.config=/etc/hadoop/conf/hdfs_jaas.conf -Dzookeeper.sasl.clientconfig=Client ${HADOOP_ZKFC_OPTS}"&lt;/PRE&gt;&lt;P&gt;Then, run the "hdfs zkfc -formatZK -force" command.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 13:02:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Switch-NameNode-HA-Zookeeper-access-from-no-security-to-SASL/m-p/167592#M29698</guid>
      <dc:creator>cnauroth</dc:creator>
      <dc:date>2016-06-13T13:02:18Z</dc:date>
    </item>
  </channel>
</rss>

