In this section, we will look at the steps to install and enable a passwordless SSH. It's always better that you have a dedicated Linux user for Hadoop and HBase processes. Let's create a user for Hadoop and HBase and name it hbasehadoop
. We will use this user to start and stop all Hadoop/HBase daemon processes. Once the user is created, we can generate SSH for the same and set up a passwordless SSH on all machines. This user must exist on all machines in the cluster. Also, this user must be provided a root access if we need to install SSH using this user, else we can create a simple user just to start and stop the process, and we can install using the existing root user. The following figure will give you a clear picture:
To add a user, the current user must be a root user. So, switch to the root user using the following command before setting up a password:
useraddhbasehadoop
To set a password for the hbasehadoop
user, use the following command:
passwdhbasehadoop
From now on, we can use this user to start, stop, and configure Hadoop/HBase.
Install SSH if it's not installed already. Use the following commands for this:
sudo apt-get install openssh-server
The preceding command will install an SSH server.
sudo apt-get install openssh-client
The preceding command will install an SSH client.
Once this installation successfully finishes, we can start configuring SSH.
Follow these steps to configure SSH:
.ssh
folder, which is in the home
folder for the user. Just press Ctrl + H to show hidden files:ssh-keygen -t rsa -P ""
Generating public/private rsa key pair.
cat $HOME/.ssh/id_rsa.pub>> $HOME/.ssh/authorized_keys
This will create authorized_keys
in the .ssh
folder and put your public key in it so that you just need to type in sshlocalhost
the next time, and it will log in to localhost without asking for the password.
.ssh
directory to 600
for security. This directory will be found in the home
directory of the user for which key has been generated.authorized_keys
file on the machine, which we need to log in to or start/stop the process without a password.18.191.168.8