Centos6.5集羣安裝64位hadoop2.2.0

Centos6.5集羣安裝64位hadoop2.2.0:

  • 網絡環境,整3臺虛擬機或者物理機,配置好相應網絡,編輯/etc/hosts, 如:

  • ssh無密碼登陸,很簡單,每臺機器都生成公鑰,密鑰(事先創建一個統一的hadoop用戶)                    
    // 生成key, 都不輸入密碼
    ssh-keygen -t rsa
    
    // 因而在用戶主目錄下會有.ssh/文件夾生成, 文件有:
     id_rsa id_rsa.pub
    將三臺機器的id_rsa.pub的內容合併到一個authorized_keys文件,並複製到三臺機器用戶主目錄/.ssh/下。
    注意, Centos默認沒有啓動ssh無密登陸,去掉/etc/ssh/sshd_config其中3行的註釋:

     

      完成後就能夠無密ssh了,如: html

      

//1. hadoop-env.sh中添加JAVA_HOME, 如:
# The java implementation to use.
export JAVA_HOME=/usr/java/jdk1.7.0_45

//2. core-site.xml(tmp目錄需手動建立):
<configuration>
        <property>
                <name>hadoop.tmp.dir</name>
                <value>/home/hadoop/tmp/hadoop-${user.name}</value>
        </property>
         <property>
                <name>fs.default.name</name>
                <value>hdfs://hadoopmaster:9000</value>
         </property>
</configuration>

//3. mapred-site.xml
<configuration>
        <property>
                <name>mapred.job.tracker</name>
                <value>hadoopmaster:9001</value>
        </property>
</configuration>

//4. hdfs-site.xml
<configuration>
        <property>
                <name>dfs.replication</name>
                <value>2</value>
        </property>
</configuration>

//5. slaves
hadoopslave1
hadoopslave2
// 配置yarn-site.xml
<configuration>
        <property>
                <name>yarn.resourcemanager.address</name>
                <value>hadoopmaster:8080</value>
        </property>
        <property>
                <name>yarn.resourcemanager.scheduler.address</name>
                <value>hadoopmaster:8081</value>
        </property>
        <property>
                <name>yarn.resourcemanager.resource-tracker.address</name>
                <value>hadoopmaster:8082</value>
        </property>
        <property>
                <name>yarn.nodemanager.resource.memory-mb</name>
                <value>10240</value>
        </property>
        <property>
                <name>yarn.nodemanager.remote-app-log-dir</name>
                <value>${hadoop.tmp.dir}/nodemanager/remote</value>
        </property>
        <property>
                <name>yarn.nodemanager.log-dirs</name>
                <value>${hadoop.tmp.dir}/nodemanager/logs</value>
        </property>
        <property>
                <name>yarn.nodemanager.aux-services</name>
                <value>mapreduce_shuffle</value>
        </property>
</configuration>
  • 將整個hadoop目錄複製到其餘兩臺機器:
scp -r hadoop-2.2.0 hadoop@hadoopslave1:/home/hadoop
scp -r hadoop-2.2.0 hadoop@hadoopslave2:/home/hadoop
  • 格式化hadoop文件系統:
hdfs namenode -format
  • 啓動hadoop集羣:
start-dfs.sh
start-yarn.sh
  • 視覺圖:

  • 收工。
相關文章
相關標籤/搜索