• (六)hadoop系列之__hadoop分布式集群环境搭建


    配置hadoop(master,slave1,slave2)
      说明:
      	NameNode: master
      	DataNode: slave1,slave2
    
      --------------------------------------------------------
       A. 修改主机的master 和 slaves		
          i. 配置slaves
             # vi hadoop/conf/slaves
             添加:192.168.126.20
                   192.168.126.30
                   ...节点 ip
                   
                   
           ii. 配置master
             添加:192.168.126.10
                   ...主机 ip
       -------------------------------------------------------- 
                    
       B. 配置master  .xml文件
            i. 配置core-site.xml
    		<?xml version="1.0"?>
    		<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
    		<!-- Put site-specific property overrides in this file. -->
    		<configuration>
    			<property>  
            <name>hadoop.tmp.dir</name>  
            <value>/home/had/hadoop/data</value>  
            <description>A base for other temporary directories.</description>  
    			</property> 
    			<property>
    				<name>fs.default.name</name>
    				<value>hdfs://192.168.126.10:9000</value>
    			</property>
    		</configuration>
    
    	 ii. 配置hdfs-site.xml
    		<?xml version="1.0"?>
    		<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
    		<!-- Put site-specific property overrides in this file. -->
    		<configuration>
    			<property>
    				<name>dfs.replication</name>
    				<value>3</value>
    				<description>Default block replication.
    					The actual number of replications can be specified when the file is created.
    					The default is used if replication is not specified in create time.
    				</description>
    			</property>
    		</configuration>
    		
    	iii.mapred-site.xml
    		 	<?xml version="1.0"?>
    		 	<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
    			<!-- Put site-specific property overrides in this file. -->
    			<configuration>
    				<property>
    					<name>mapred.job.tracker</name>
    					<value>192.168.126.10:9001</value>
    				</property>
    			</configuration>
    			
    		-------------------------------------------------------------	
       C. 配置slave1,slave2 (同上)
           i. core-site.xml 
           ii. mapred-site.xml 		
    	 ---------------------------------------------------------------	
    	 	
       D. 配置 master,slave1,slave2的hadoop系统环境
         	$ vi /home/hadoop/.bashrc
        	添加:
    			export HADOOP_HOME=/home/hadoop/hadoop-0.20.2
    			export HADOOP_CONF_DIR=$HADOOP_HOME/conf    
    			export PATH=/home/hadoop/hadoop-0.20.2/bin:$PATH
       ----------------------------------------------------------------
    
    初始化文件系统

    注意:有时候会出现以下错误信息

     。。。

     11/08/18 17:02:35 INFO ipc.Client: Retrying connect to server: localhost/192.168.126 .10:9000. Already tried 0 time(s).

     Bad connection to FS. command aborted.

     此时需要把根目录下的tmp文件里面的内容删掉,然后重新格式化即可。

    启动Hadoop:

    完成后进行测试:

    测试
    						
      $ bin/hadoop fs -put ./README.txt test1
      $ bin/hadoop fs -ls
      Found 1 items
      drwxr-xr-x   - hadoop supergroup          0 2013-07-14 00:51 /user/hadoop/test1
      $hadoop jar hadoop-0.20.2-examples.jar wordcount /user/hadoop/test1/README.txt output1 
    结果出现以下问题
    

    注:测试过程当中会有一些错误信息。一下是我在安装的过程当中碰到的几个问题。

    1.org.apache.hadoop.ipc.RemoteException: org.apache.hadoop.hdfs.server.namenode.SafeModeException: Cannot delete /home/hadoop/hadoop-datastore
    /hadoop-hadoop/mapred/system/job_201307132331_0005. Name node is in safe mode. 关闭安全模式: bin/hadoop dfsadmin -safemode leave 2.org.apache.hadoop.ipc.RemoteException: java.io.IOException: File /user/hadoop/test1/README.txt could only be replicated to 0 nodes,
    instead of 1 情况1. hadoop.tmp.dir 磁盘空间不足。 解决方法: 换个足够空间的磁盘即可。 情况2. 查看防火墙状态 /etc/init.d/iptables status /etc/init.d/iptables stop//关闭所有的防火墙 情况3.先后启动namenode、datanode(我的是这种情况)
    参考文章http://sjsky.iteye.com/blog/1124545

     最后执行界面如下:

     查看hdfs运行状态(web):http://192.168.126.10:50070/dfshealth.jsp

     

     查看map-reduce信息(web):http://192.168.126.10:50030/jobtracker.jsp


    整个Hadoop集群搭建结束。

  • 相关阅读:
    转:flash 键值对应
    (转)我叫AGAL,来自Adobe 【Part1】
    (转)as3 updateAfterEvent的作用
    (转)远程桌面连接由于网络错误而丢失
    (转)你有所不知的HTML發佈Flash的參數(三):base
    不要再吹水地球人听不懂的技术,咱来点干货!中文前端UI框架Kit(三)揭开高级事件管理的神秘面纱
    非常惊艳的Css3的桌面上散落的相片效果,以及单击放大图片的LightBox效果(独立Js非jQuery)的实现原理
    不要再吹水地球人听不懂的技术,咱来点干货!中文前端UI框架Kit(一)大致了解下Kit是啥?
    (转)JS正则表达式获取分组内容的方法
    分享一个Css3效果无比惊艳的全屏图片切换效果(Css浏览器Only)
  • 原文地址:https://www.cnblogs.com/FCWORLD/p/3188802.html
Copyright © 2020-2023  润新知