ssh免登陆

主要用于hadoop HA相关

安装

  • yum -y install openssh-clients

配置

输入命令ssh-keygen,一直回车即可

    [root@hadoop-bbb .ssh]# ssh-keygen 
    Generating public/private rsa key pair.
    Enter file in which to save the key (/root/.ssh/id_rsa): 
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in /root/aaa/id_rsa.
    Your public key has been saved in /root/aaa/id_rsa.pub.
    The key fingerprint is:
    f8:e3:e7:c5:58:9a:4c:36:57:c1:0d:a3:5e:ff:ac:07 root@hadoop-bbb
    The key's randomart image is:
    +--[ RSA 2048]----+
    |             .+o |
    |             ..o.|
    |            . o  |
    |       .   . o . |
    |      . S + +   .|
    |       . + O  E..|
    |        o = o  .o|
    |       . ...   ..|
    |        .o.   .. |
    +-----------------+
    [root@hadoop-bbb ~]#

然后

    cd /root/.ssh/
    mv id_rsa.pub authorized_keys

然后把root/.ssh 复制到其他的机器即可

注意事项

    (ps: 只需要 ssh 互相登陆一下 或许信任的凭据即可)