why hadoop asks for password before starting any o

2019-08-04 20:50发布

问题:

why ssh login is required before starting hadoop? And why hadoop asks for password for starting any of the services?

shravilp@shravilp-HP-15-Notebook-PC:~/hadoop-2.6.3$ sbin/start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
Starting namenodes on [localhost] 
shravilp@localhost's password: 
localhost: starting namenode, logging to /home/shravilp/hadoop-              

回答1:

In Ubuntu, you can use the following one time set up steps to eliminate the need to enter password when running hadoop commands, for example, start-dfs.sh, start-yarn.sh:

sudo apt-get install openssh-server openssh-client
ssh-keygen -t rsa
ssh-copy-id user@localhost

replace user with your username. It was tested on Ubuntu 16.04.2, hadoop-2.7.3, jdk1.8.0_121

Note: 1. when execute "ssh-keygen -t rsa" command, you can simply press ENTER three times to accept the default values. 2. when execute "ssh-copy-id user@localhost" command, "Are you sure you want to continue connecting (yes/no)?" enter "yes", then your password

See this question also



回答2:

It asks for password as it uses the SSH protocol, You could avoid this by adding your public key to all the ssh files of each node to make it passwordless.