手机版
你好,游客 登录 注册
背景:
阅读新闻

Hadoop 3台虚拟机的小型集群

[日期:2012-07-25] 来源:Linux社区  作者:Linux [字体:大 中 小]

部署环境:

OS:Red Hat Enterprise Linux Client release 5.5

JDK:JDKk1.6.0_23

Hadoop:Hadoop-0.20.2

VMWare:8.0

网络环境:

192.168.2.86  namenode   secondnamenode

192.168.4.123 datanode

192.168.4.124 datanode

配置以及安装步骤:

1. 网络环境配置

(1) 关闭所有网络主机的防火墙,service iptables stop

(2) /etc/hosts 文件内容追加

192.168.2.86  master 
192.168.4.123  slave1 
192.168.4.124  slave2 

2. 建立ssh互信

(1) 修改 vi  /etc/ssh/sshd_config

  1. #    $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $  
  2.   
  3. # This is the sshd server system-wide configuration file.  See  
  4. # sshd_config(5) for more information.  
  5.   
  6. # This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin  
  7.   
  8. # The strategy used for options in the default sshd_config shipped with  
  9. # OpenSSH is to specify options with their default value where  
  10. # possible, but leave them commented.  Uncommented options change a  
  11. # default value.  
  12.   
  13. #Port 22  
  14. #Protocol 2,1  
  15. Protocol 2  
  16. #AddressFamily any  
  17. #ListenAddress 0.0.0.0  
  18. #ListenAddress ::  
  19.   
  20. # HostKey for protocol version 1  
  21. #HostKey /etc/ssh/ssh_host_key  
  22. # HostKeys for protocol version 2  
  23. #HostKey /etc/ssh/ssh_host_rsa_key  
  24. #HostKey /etc/ssh/ssh_host_dsa_key  
  25.   
  26. # Lifetime and size of ephemeral version 1 server key  
  27. #KeyRegenerationInterval 1h  
  28. #ServerKeyBits 768  
  29.   
  30. # Logging  
  31. # obsoletes QuietMode and FascistLogging  
  32. #SyslogFacility AUTH  
  33. SyslogFacility AUTHPRIV  
  34. #LogLevel INFO  
  35.   
  36. # Authentication:  
  37.   
  38. #LoginGraceTime 2m  
  39. #PermitRootLogin yes  
  40. #PermitRootLogin yes  
  41. #StrictModes yes  
  42. #MaxAuthTries 6  
  43.   
  44. #RSAAuthentication yes  
  45. #PubkeyAuthentication yes  
  46. #PubkeyAuthentication no  
  47. #AuthorizedKeysFile    .ssh/authorized_keys  
  48.   
  49. # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts  
  50. #RhostsRSAAuthentication no  
  51. # similar for protocol version 2  
  52. #HostbasedAuthentication no  
  53. # Change to yes if you don't trust ~/.ssh/known_hosts for  
  54. # RhostsRSAAuthentication and HostbasedAuthentication  
  55. #IgnoreUserKnownHosts no  
  56. # Don't read the user's ~/.rhosts and ~/.shosts files  
  57. #IgnoreRhosts yes  
  58.   
  59. # To disable tunneled clear text passwords, change to no here!  
  60. #PasswordAuthentication yes  
  61. #PermitEmptyPasswords no  
  62. #PasswordAuthentication yes  
  63. PasswordAuthentication no  
  64. AuthorizedKeysFile .ssh/authorized_keys  
  65.   
  66. # Change to no to disable s/key passwords  
  67. #ChallengeResponseAuthentication yes  
  68. ChallengeResponseAuthentication no  
  69.   
  70. # Kerberos options  
  71. #KerberosAuthentication no  
  72. #KerberosOrLocalPasswd yes  
  73. #KerberosTicketCleanup yes  
  74. #KerberosGetAFSToken no  
  75.   
  76. # GSSAPI options  
  77. #GSSAPIAuthentication no  
  78. GSSAPIAuthentication yes  
  79. #GSSAPICleanupCredentials yes  
  80. GSSAPICleanupCredentials yes  
  81.   
  82. # Set this to 'yes' to enable PAM authentication, account processing,   
  83. # and session processing. If this is enabled, PAM authentication will   
  84. # be allowed through the ChallengeResponseAuthentication mechanism.   
  85. # Depending on your PAM configuration, this may bypass the setting of   
  86. # PasswordAuthentication, PermitEmptyPasswords, and   
  87. # "PermitRootLogin without-password". If you just want the PAM account and   
  88. # session checks to run without PAM authentication, then enable this but set   
  89. # ChallengeResponseAuthentication=no  
  90. #UsePAM no  
  91. UsePAM yes  
  92.   
  93. # Accept locale-related environment variables  
  94. AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES   
  95. AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT   
  96. AcceptEnv LC_IDENTIFICATION LC_ALL  
  97. #AllowTcpForwarding yes  
  98. #GatewayPorts no  
  99. #X11Forwarding no  
  100. X11Forwarding yes  
  101. #X11DisplayOffset 10  
  102. #X11UseLocalhost yes  
  103. #PrintMotd yes  
  104. #PrintLastLog yes  
  105. #TCPKeepAlive yes  
  106. #UseLogin no  
  107. #UsePrivilegeSeparation yes  
  108. #PermitUserEnvironment no  
  109. #Compression delayed  
  110. #ClientAliveInterval 0  
  111. #ClientAliveCountMax 3  
  112. #ShowPatchLevel no  
  113. #UseDNS yes  
  114. #PidFile /var/run/sshd.pid  
  115. #MaxStartups 10  
  116. #PermitTunnel no  
  117. #ChrootDirectory none  
  118.   
  119. # no default banner path  
  120. #Banner /some/path  
  121.   
  122. # override default of no subsystems  
  123. Subsystem    sftp    /usr/libexec/openssh/sftp-server  

(2)  生成公钥、私钥文件

生成密钥到用户主目录下

ssh -keygen -t dsa -P '' -f ~/.ssh/id_dsa   
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys  

将authorized_keys文件拷贝到两台slave主机

scp authorized_keys slave1:~/.ssh/   
scp authorized_keys slave2:~/.ssh/  

(3) 开启ssh-agent服务

ssh-agent bash --login -i

ssh-add 添加密钥

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款