setup cluster -- ssh to each other with no key ssh免密钥登陆配置

来源:互联网 发布:淘宝上的银泰是正品吗 编辑:程序博客网 时间:2024/05/04 07:18
声明:文章原创,转载需注明出处。由于文章大多是学习过程中的记录内容,技术能力有限,希望大家指出其中错误,共同交流进步。由此原因,文章会不定期改善,看原文最新内容,请到:http://blog.chinaunix.net/uid/29454152.html
to  convenient for after we need to do this.
first set the fix ip address
then set the virtual machine network mode 
then ping to each other test the network can work
the install the ssh and other operate
1. set the different ip address of every virtual machine
    open the terminal use "ctrl+alt+t"
    set the file "interfaces "  at the directory "/etc/network"
    one of my set like below 

i set my three machine address master/10.0.2.10 ; slave1/10.0.2.20 ; slave2/10.0.2.30;

2. set network mode of the virtual machine
    set the  "bridged adapter" and select the "eth0" like below

set all the virtual machine in the same mode 

3. ping to each other 
    like me: at 10.0.2.10 ping 10.0.2.20 appear like below
    

4. install ssh at all virtual machine
    (1 install ssh
    because you need network at here you must restore the network set .
    like set the virtual network mode to be "NAT"
    and note the set in "etc/network/interfaces" like below
    and after this set you must set network in "bridged adapter" and select the "eth0"
    and reset the ip address of each machines


    then install ssh
    use the command "sudo apt-get install ssh"
        install scp which used after
    use the command "sudo apt-get install scp"         

    (2 generate the private key and the public key at all machines
    use comand "ssh-keygen -t dsa"
    then will generate ".ssh" directory at your user directory,and you can use "ls -l" to see
    the cd into the ".ssh" and use the comand "cat id-dsa.pub >> authorized_keys"
    then you can see the file in the ".ssh" like below

    (3 use "scp" command to copy file to other virtual machine
    use the scp command like me copy "authorized_keys" from 10.0.2.10 to 10.0.2.20
    "scp /home/warrior/.ssh/authorized_keys  warrior@10.0.2.20:/home/warrior/.ssh/authorized_keys"
    then login at the 10.0.2.20 and cd into ".ssh" directory 
    the same operate 
    "ssh-keygen -t dsa"
    "cat id-dsa.pub >> authorized_keys"
    and then scp the "authorized_keys" to other virtual machine like below at 10.0.2.20 copy to 10.0.2.30
    "scp /home/warrior/.ssh/authorized_keys  warrior@10.0.2.30:/home/warrior/.ssh/authorized_keys"
    do this until you confirm the file "authorized_keys" contain all the "id_dsa.pub" of each virtual machines and all the machines have the same "authorized_keys"

    
    then all the operate and set is over. and you can install "hadoop" at first "spark" at second then use "scp" copy it to all slave machines.



    If you have some other network problems, you can visit my other blog : http://blog.chinaunix.net/uid-29454152-id-5149181.html

0 0