How Do You Solve the Problem of Being Prompted for Credentials after You Run the start-dfs.sh Script?

Problem scenario
You try to start Hadoop's dfs in a multi-node deployment.  All the Hadoop nodes are running Linux.  You run this:

bash /usr/local/hadoop/sbin/start-dfs.sh

You see this:

Starting namenodes on [hadoopmaster]
hadoopmaster: starting namenode, logging to /usr/local/hadoop/logs/hadoop-root-namenode-hadoopmaster.out
root@hadoopdatanode's password: localhost: starting datanode, logging to /usr/local/hadoop/logs/hadoop-root-datanode-hadoopmaster.out
hadoopmaster: starting datanode, logging to /usr/local/hadoop/logs/hadoop-root-datanode-hadoopmaster.out
localhost: ulimit -a for user root
localhost: core file size          (blocks, -c) 0
localhost: data seg size           (kbytes, -d) unlimited
localhost: scheduling priority             (-e) 0
localhost: file size               (blocks, -f) unlimited
localhost: pending signals                 (-i) 2544
localhost: max locked memory       (kbytes, -l) 64
localhost: max memory size         (kbytes, -m) unlimited
localhost: open files                      (-n) 1024
localhost: pipe size            (512 bytes, -p) 8

You notice that DFS is not running properly on the datanode (aka slave node).  You think the prompts for "root@hadoopdatanode" (the Hadoop slave server) are a sign of the  problem.  What do you do?

Solution
If you want to passwordlessly SSH as a given user from one server to another, the remote server's authorized_keys must have the public key from the local server (server from which you attempt to initiate the SSH connection).

In this case you are being prompted for a password.  The remote server would not do this if its /root/.ssh/authorized_keys had the id_rsa.pub file for the root  user on the starting (local) server.  The starting server is the Hadoop master server.

From the Hadoop namenode (aka master) server, do this:

cat /root/.ssh/id_rsa.pub

Copy the output to the last line of /root/.ssh/authorized_keys on the destination (non-master) Hadoop datanode server.

Leave a comment

Your email address will not be published. Required fields are marked *