- Hadoop Beginner's Guide
- Garry Turkington
- 393字
- 2025-02-17 19:37:20
Time for action – setting up SSH
Carry out the following steps to set up SSH:
- Create a new OpenSSL key pair with the following commands:
$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/hadoop/.ssh/id_rsa): Created directory '/home/hadoop/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/hadoop/.ssh/id_rsa. Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub. …
- Copy the new public key to the list of authorized keys by using the following command:
$ cp .ssh/id _rsa.pub .ssh/authorized_keys
- Connect to the local host.
$ ssh localhost The authenticity of host 'localhost (127.0.0.1)' can't be established. RSA key fingerprint is b6:0c:bd:57:32:b6:66:7c:33:7b:62:92:61:fd:ca:2a. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
- Confirm that the password-less SSH is working.
$ ssh localhost $ ssh localhost
What just happened?
Because Hadoop requires communication between multiple processes on one or more machines, we need to ensure that the user we are using for Hadoop can connect to each required host without needing a password. We do this by creating a Secure Shell (SSH) key pair that has an empty passphrase. We use the ssh-keygen
command to start this process and accept the offered defaults.
Once we create the key pair, we need to add the new public key to the stored list of trusted keys; this means that when trying to connect to this machine, the public key will be trusted. After doing so, we use the ssh
command to connect to the local machine and should expect to get a warning about trusting the host certificate as just shown. After confirming this, we should then be able to connect without further passwords or prompts.
Configuring and running Hadoop
So far this has all been pretty straightforward, just downloading and system administration. Now we can deal with Hadoop directly. Finally! We'll run a quick example to show Hadoop in action. There is additional configuration and set up to be performed, but this next step will help give confidence that things are installed and configured correctly so far.