Database Reference
In-Depth Information
znode held by any other node. If there is no lock, the ZKFC tries to acquire the
lock and initiates the failover to set the local namenode as the active namenode.
The ZooKeeper daemons typically run on three or five nodes (number of nodes should be
an odd number) and can be collocated with the active and standby namenodes.
Perform the following steps as user
hduser
to configure ZooKeeper for automatic fail-
over:
1. Shut down the entire cluster before configuring ZooKeeper using the following
command on every node:
$ for x in 'cd /etc/init.d; ls hadoop*'; do sudo
service $x stop; done
2. Install ZooKeeper on all the nodes that need to be used as ZooKeeper nodes using
the following command:
$ sudo yum install zookeeper-server
3. Start the ZooKeeper service using the following commands:
$ sudo service zookeeper-server init --myid=1 --force
$ sudo service zookeeper-server start
4. Install the ZKFC Failover controller on all nodes that host the namenodes using
the following command:
$ sudo yum install hadoop-hdfs-zkfc
5. Update the
hdfs-site.xml
file to include the following property and copy to
all the nodes:
<property>
<name>dfs.ha.automatic-failover.enabled</name>
<value>true</value>
</property>
6. Update the
core-site.xml
to include the following property and copy it to all
the nodes:
<property>
<name>ha.zookeeper.quorum</name>