最近在学习hadoop,需要搭建一个分布式的环境,并且所有机器都可以无需密码就能登陆其它机器,这就需要在机器之前建立ssh互信
三台机器:
hadoop.vm01
hadoop.vm02
hadoop.vm03
操作:
hadoop.vm01:
work@hadoop.vm01:~$ ssh-keygen -t rsa
会出现很多选择,可以都默认(空白)
work@hadoop.vm01:~$ cd .ssh
work@hadoop.vm01:~/.ssh$ cat id_rsa.pub >>authorized_keys
work@hadoop.vm01:~/.ssh$ scp authorized_keys hadoop.vm02:/home/work/.ssh/authorized_keys
hadoop.vm02:
work@hadoop.vm02:~$ ssh-keygen -t rsa
work@hadoop.vm02:~$ cd .ssh
work@hadoop.vm02:~/.ssh$ cat id_rsa.pub >>authorized_keys
work@hadoop.vm02:~/.ssh$ scp authorized_keys hadoop.vm03:/home/work/.ssh.authorized_keys
hadoop.vm03:
work@hadoop.vm03:~$ ssh-keygen -t rsa
work@hadoop.vm03:~$ cd .ssh
work@hadoop.vm03:~/.ssh$ cat id_rsa.pub >>authorized_keys
最后将authorized_keys拷贝到hadoop.vm01\hadoop.vm02机器上去
work@hadoop.vm03:~/.ssh$ scp authorized_keys hadoop.vm01:/home/work/.ssh/authorized_keys
work@hadoop.vm03:~/.ssh$ scp authorized_keys hadoop.vm02:/home/work/.ssh/authorized_keys