[AWS] 03. mac 터미널을 통해 AWS 인스턴스 접속


mac 터미널을 통해 AWS 인스턴스 접속

Mac 터미널을 통해 AWS EC2 리눅스 접속

Install Hadoop on AWS

namenode 인스턴스 접속

  • ‘연결’ 버튼 클릭 Screen Shot 2019-04-23 at 11 03 46 AM

  • 인스턴스에 연결 내용 확인 Screen Shot 2019-04-23 at 11 26 31 AM

  • 터미널 실행
  • namenode EC2 접속
      chmod 400 ~/.ssh/mykeypair.pem
      ssh -i ~/.ssh/hdcluster.pem ec2-user@ec2-15-164-47-50.ap-northeast-2.compute.amazonaws.com
    
  • 인스턴스 접속 참고 URL

Screen Shot 2019-04-23 at 11 21 47 AM




namenode 호스트 이름 변경

  • 참고 URL
      # namanode 접속한 터미널에서 
      $ sudo vi /etc/sysconfig/network
    
      # vi 편집기 실행 후 i를 눌러 편집 사용
      NETWORKING=yes
      HOSTNAME=namenode.localdomain
      NOZEROCONF=yes
      # :wq!를 눌러 vi 편집기 종료
    

Screen Shot 2019-04-23 at 11 33 16 AM Screen Shot 2019-04-23 at 11 31 57 AM

    # namanode 접속한 터미널에서 
    $ sudo vi /etc/hosts

    # vi 편집기 실행 후 i를 눌러 편집 사용
    127.0.0.1   namenode.localdomain localhost localhost.localdomain
    ::1         localhost6 localhost6.localdomain6
    # :wq!를 눌러 vi 편집기 종료

Screen Shot 2019-04-23 at 11 37 48 AM Screen Shot 2019-04-23 at 11 38 30 AM

    # 인스턴스를 재부팅 한다.
    $ sudo reboot

Screen Shot 2019-04-23 at 11 40 08 AM

    # namnnode 인스턴스에 로그인

Screen Shot 2019-04-23 at 11 41 23 AM

    # 호스트 이름 변경되었는지 확인. 
    $ hostname

Screen Shot 2019-04-23 at 11 42 15 AM




나머지 4개(snamenode, data01, data02, data03)도 설정한다.

    @KANG ~ $ssh -i ~/.ssh/hdcluster.pem ec2-user@ec2-13-125-187-86.ap-northeast-2.compute.amazonaws.com
    Warning: Identity file hdcluster.pem not accessible: No such file or directory.
    The authenticity of host 'ec2-13-125-187-86.ap-northeast-2.compute.amazonaws.com (13.125.187.86)' can't be established.
    ECDSA key fingerprint is SHA256:qk/vYI7wHe+B/DXvVvElgXiwh466rD6pHw1W/3DYBTo.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'ec2-13-125-187-86.ap-northeast-2.compute.amazonaws.com,13.125.187.86' (ECDSA) to the list of known hosts.
    ec2-user@ec2-13-125-187-86.ap-northeast-2.compute.amazonaws.com: Permission denied (publickey).

    @KANG ~ $ssh -i ~/.ssh/hdcluster.pem ec2-user@ec2-13-125-187-86.ap-northeast-2.compute.amazonaws.com
    
           __|  __|_  )
           _|  (     /   Amazon Linux AMI
          ___|\___|___|
    
    https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/
    -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
    
    [ec2-user@ip-172-31-30-31 ~]$ hostname
    ip-172-31-30-31
    
    [ec2-user@ip-172-31-30-31 ~]$ sudo vi /etc/sysconfig/network
    [ec2-user@ip-172-31-30-31 ~]$ sudo vi /etc/hosts
    [ec2-user@ip-172-31-30-31 ~]$ sudo reboot
    [ec2-user@ip-172-31-30-31 ~]$ 
    Broadcast message from ec2-user@ip-172-31-30-31
        (/dev/pts/0) at 4:03 ...
    
    The system is going down for reboot NOW!
    Connection to ec2-13-125-187-86.ap-northeast-2.compute.amazonaws.com closed by remote host.
    Connection to ec2-13-125-187-86.ap-northeast-2.compute.amazonaws.com closed.

    @KANG ~ $ssh -i ~/.ssh/hdcluster.pem ec2-user@ec2-13-125-187-86.ap-northeast-2.compute.amazonaws.com
    Last login: Tue Apr 23 04:01:04 2019 from 222.107.238.24
    
           __|  __|_  )
           _|  (     /   Amazon Linux AMI
          ___|\___|___|
    
    https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/
    22 package(s) needed for security, out of 29 available
    Run "sudo yum update" to apply all updates.
    -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
    
    [ec2-user@snamenode ~]$ hostname
    snamenode.localdomain
    
    [ec2-user@snamenode ~]$ exit
    logout
    Connection to ec2-13-125-187-86.ap-northeast-2.compute.amazonaws.com closed.
    @KANG ~ $ssh -i ~/.ssh/hdcluster.pem ec2-user@ec2-15-164-13-90.ap-northeast-2.compute.amazonaws.com
    The authenticity of host 'ec2-15-164-13-90.ap-northeast-2.compute.amazonaws.com (15.164.13.90)' can't be established.
    ECDSA key fingerprint is SHA256:cqTcW7anI+bM9V1xrDPyj/M0HQoP2exNn21rxlQul/Y.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'ec2-15-164-13-90.ap-northeast-2.compute.amazonaws.com,15.164.13.90' (ECDSA) to the list of known hosts.
    
           __|  __|_  )
           _|  (     /   Amazon Linux AMI
          ___|\___|___|
    
    https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/
    22 package(s) needed for security, out of 29 available
    Run "sudo yum update" to apply all updates.
    -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
    
    [ec2-user@ip-172-31-30-98 ~]$ sudo vi /etc/sysconfig/network
    [ec2-user@ip-172-31-30-98 ~]$ sudo vi /etc/hosts
    [ec2-user@ip-172-31-30-98 ~]$ sudo reboot
    [ec2-user@ip-172-31-30-98 ~]$ 
    Broadcast message from ec2-user@ip-172-31-30-98
        (/dev/pts/0) at 4:06 ...
    
    The system is going down for reboot NOW!
    Connection to ec2-15-164-13-90.ap-northeast-2.compute.amazonaws.com closed by remote host.
    Connection to ec2-15-164-13-90.ap-northeast-2.compute.amazonaws.com closed.
    
    @KANG ~ $ssh -i ~/.ssh/hdcluster.pem ec2-user@ec2-15-164-13-90.ap-northeast-2.compute.amazonaws.com
    Last login: Tue Apr 23 04:05:14 2019 from 222.107.238.24
    
           __|  __|_  )
           _|  (     /   Amazon Linux AMI
          ___|\___|___|
    
    https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/
    22 package(s) needed for security, out of 29 available
    Run "sudo yum update" to apply all updates.
    -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
    
    [ec2-user@data01 ~]$ hostname
    data01.localdomain
    
    [ec2-user@data01 ~]$ exit
    logout
    Connection to ec2-15-164-13-90.ap-northeast-2.compute.amazonaws.com closed.
    @KANG ~ $ssh -i ~/.ssh/hdcluster.pem ec2-user@ec2-13-124-188-140.ap-northeast-2.compute.amazonaws.com
    The authenticity of host 'ec2-13-124-188-140.ap-northeast-2.compute.amazonaws.com (13.124.188.140)' can't be established.
    ECDSA key fingerprint is SHA256:kz9D7MjzhpevKpH41qyXP0P9vqFZjapbkL0sfJSwGfQ.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'ec2-13-124-188-140.ap-northeast-2.compute.amazonaws.com,13.124.188.140' (ECDSA) to the list of known hosts.
    
           __|  __|_  )
           _|  (     /   Amazon Linux AMI
          ___|\___|___|
    
    https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/
    22 package(s) needed for security, out of 29 available
    Run "sudo yum update" to apply all updates.
    -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
    
    [ec2-user@ip-172-31-28-203 ~]$ sudo vi /etc/sysconfig/network
    [ec2-user@ip-172-31-28-203 ~]$ sudo vi /etc/hosts
    [ec2-user@ip-172-31-28-203 ~]$ sudo reboot
    [ec2-user@ip-172-31-28-203 ~]$ 
    Broadcast message from ec2-user@ip-172-31-28-203
        (/dev/pts/0) at 4:08 ...
    
    The system is going down for reboot NOW!
    Connection to ec2-13-124-188-140.ap-northeast-2.compute.amazonaws.com closed by remote host.
    Connection to ec2-13-124-188-140.ap-northeast-2.compute.amazonaws.com closed.
    
    @KANG ~ $ssh -i ~/.ssh/hdcluster.pem ec2-user@ec2-13-124-188-140.ap-northeast-2.compute.amazonaws.com
    Last login: Tue Apr 23 04:07:35 2019 from 222.107.238.24
    
           __|  __|_  )
           _|  (     /   Amazon Linux AMI
          ___|\___|___|
    
    https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/
    22 package(s) needed for security, out of 29 available
    Run "sudo yum update" to apply all updates.
    -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
    
    [ec2-user@data02 ~]$ hostname
    data02.localdomain
    
    [ec2-user@data02 ~]$ reboot
    reboot: Need to be root
    
    [ec2-user@data02 ~]$ exit
    logout
    Connection to ec2-13-124-188-140.ap-northeast-2.compute.amazonaws.com closed.
    @KANG ~ $ssh -i ~/.ssh/hdcluster.pem ec2-user@ec2-52-78-13-217.ap-northeast-2.compute.amazonaws.com
    The authenticity of host 'ec2-52-78-13-217.ap-northeast-2.compute.amazonaws.com (52.78.13.217)' can't be established.
    ECDSA key fingerprint is SHA256:QW8UD4I2AZkW0c8wIgho6or/+mQqxp8Aq+cR8C4rqIc.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'ec2-52-78-13-217.ap-northeast-2.compute.amazonaws.com,52.78.13.217' (ECDSA) to the list of known hosts.
    
           __|  __|_  )
           _|  (     /   Amazon Linux AMI
          ___|\___|___|
    
    https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/
    -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
    
    [ec2-user@ip-172-31-17-175 ~]$ sudo vi /etc/sysconfig/network
    [ec2-user@ip-172-31-17-175 ~]$ sudo vi /etc/hosts
    [ec2-user@ip-172-31-17-175 ~]$ sudo reboot
    [ec2-user@ip-172-31-17-175 ~]$ 
    Broadcast message from ec2-user@ip-172-31-17-175
        (/dev/pts/0) at 4:10 ...
    
    The system is going down for reboot NOW!
    Connection to ec2-52-78-13-217.ap-northeast-2.compute.amazonaws.com closed by remote host.
    Connection to ec2-52-78-13-217.ap-northeast-2.compute.amazonaws.com closed.
    
    @KANG ~ $ssh -i ~/.ssh/hdcluster.pem ec2-user@ec2-52-78-13-217.ap-northeast-2.compute.amazonaws.com
    Last login: Tue Apr 23 04:09:50 2019 from 222.107.238.24
    
           __|  __|_  )
           _|  (     /   Amazon Linux AMI
          ___|\___|___|
    
    https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/
    22 package(s) needed for security, out of 29 available
    Run "sudo yum update" to apply all updates.
    -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
    
    [ec2-user@data03 ~]$ hostname
    data03.localdomain
    
    [ec2-user@data03 ~]$ 

References

개발자님들 덕분에 많이 배울 수 있었습니다. 감사의 말씀 드립니다.





© 2020. GANGPRO. All rights reserved.