欢迎投稿

今日深度:

ubuntu server 12 上搭建 hadoop2.2 单机伪分布式,ubuntuhadoop2.2

ubuntu server 12 上搭建 hadoop2.2 单机伪分布式,ubuntuhadoop2.2


注:我把解压后的hadoop文件重命名为hadoop,放在opt目录下
$source /etc/profile
  • $ cd /opt/hadoop/etc/hadoop/修改hadoop-env.sh修改JAVA_HOME,这里JAVA_HOME的路径必须指定为真实的路径,不能引用${JAVA_HOME},否则运行的时候会有错误JAVA_HOME is not set
    1. export JAVA_HOME=/opt/jdk  
  • 修改core-site.xml注:创建/tmp/hadoop/hadoop-hadoop 目录
    1. <configuration>  
    2.   <property>  
    3.     <name>fs.default.name</name>  
    4.     <value>hdfs://localhost:9000</value>  
    5.   </property>  
    6.   <property>  
    7.     <name>hadoop.tmp.dir</name>  
    8.     <value>/tmp/hadoop/hadoop-hadoop</value>  
    9.   </property>  
    10. </configuration> 

  • 修改hdfs-site.xml 

    其中,/home/hadoop/dfs/name,/home/hadoop/dfs/data都是文件系统中的目录,需要先新建

    1. <configuration>  
    2.   <property>    
    3.     <name>dfs.namenode.name.dir</name>    
    4.     <value>file:/home/hadoop/dfs/name</value>    
    5.     <description>Determines where on the local filesystem the DFS name node    
    6.       should store the name table.  If this is a comma-delimited list    
    7.       of directories then the name table is replicated in all of the    
    8.       directories, for redundancy. </description>    
    9.     <final>true</final>    
    10.   </property>    
    11.     
    12.   <property>    
    13.     <name>dfs.datanode.data.dir</name>    
    14.     <value>file:/home/hadoop/dfs/data</value>    
    15.     <description>Determines where on the local filesystem an DFS data node    
    16.        should store its blocks.  If this is a comma-delimited    
    17.        list of directories, then data will be stored in all named    
    18.        directories, typically on different devices.    
    19.        Directories that do not exist are ignored.    
    20.     </description>    
    21.     <final>true</final>    
    22.   </property>    
    23.     
    24.   <property>    
    25.     <name>dfs.replication</name>    
    26.     <value>1</value>    
    27.   </property>    
    28.     
    29.   <property>    
    30.     <name>dfs.permissions</name>    
    31.     <value>false</value>    
    32.   </property>    
    33. </configuration>  

  • 修改mapred-site.xml
    1. <configuration>  
    2.   <property>    
    3.     <name>mapreduce.framework.name</name>    
    4.     <value>yarn</value>    
    5.   </property>   
    6.     
    7.   <property>    
    8.     <name>mapred.system.dir</name>    
    9.     <value>file:/home/hadoop/mapred/system</value>    
    10.     <final>true</final>    
    11.   </property>    
    12.     
    13.   <property>    
    14.     <name>mapred.local.dir</name>    
    15.     <value>file:/home/hadoop/mapred/local</value>    
    16.     <final>true</final>    
    17.   </property>  
    18. </configuration>  
    注:由mapred-site.xml.template 复制一份
  • 修改yarn-site.xml
    1. <configuration>  
    2.   
    3. <!-- Site specific YARN configuration properties -->  
    4.   <property>  
    5.     <name>yarn.resourcemanager.resource-tracker.address</name>  
    6.     <value>localhost:8081</value>  
    7.     <description>host is the hostname of the resource manager and   
    8.     port is the port on which the NodeManagers contact the Resource Manager.  
    9.     </description>  
    10.   </property>  
    11.   
    12.   <property>  
    13.     <name>yarn.resourcemanager.scheduler.address</name>  
    14.     <value>localhost:8082</value>  
    15.     <description>host is the hostname of the resourcemanager and port is the port  
    16.     on which the Applications in the cluster talk to the Resource Manager.  
    17.     </description>  
    18.   </property>  
    19.   
    20.   <property>  
    21.     <name>yarn.resourcemanager.scheduler.class</name>  
    22.     <value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler</value>  
    23.     <description>In case you do not want to use the default scheduler</description>  
    24.   </property>  
    25.   
    26.   <property>  
    27.     <name>yarn.resourcemanager.address</name>  
    28.     <value>localhost:8083</value>  
    29.     <description>the host is the hostname of the ResourceManager and the port is the port on  
    30.     which the clients can talk to the Resource Manager. </description>  
    31.   </property>  
    32.   
    33.   <property>  
    34.     <name>yarn.nodemanager.local-dirs</name>  
    35.     <value></value>  
    36.     <description>the local directories used by the nodemanager</description>  
    37.   </property>  
    38.   
    39.   <property>  
    40.     <name>yarn.nodemanager.address</name>  
    41.     <value>0.0.0.0:port</value>  
    42.     <description>the nodemanagers bind to this port</description>  
    43.   </property>    
    44.   
    45.   <property>  
    46.     <name>yarn.nodemanager.resource.memory-mb</name>  
    47.     <value>10240</value>  
    48.     <description>the amount of memory on the NodeManager in GB</description>  
    49.   </property>  
    50.    
    51.   <property>  
    52.     <name>yarn.nodemanager.remote-app-log-dir</name>  
    53.     <value>/app-logs</value>  
    54.     <description>directory on hdfs where the application logs are moved to </description>  
    55.   </property>  
    56.   
    57.    <property>  
    58.     <name>yarn.nodemanager.log-dirs</name>  
    59.     <value></value>  
    60.     <description>the directories used by Nodemanagers as log directories</description>  
    61.   </property>  
    62.   
    63.   <property>  
    64.     <name>yarn.nodemanager.aux-services</name>  
    65.     <value>mapreduce.shuffle</value>  
    66.     <description>shuffle service that needs to be set for Map Reduce to run </description>  
    67.   </property>  
    68. </configuration>  
  • 启动hdfs以及yarn

    完成以上配置后可以检测是否配置成
    首先格式化namenode
             $ hdfs namenode -format
    然后启动hdfs
            $ start-dfs.sh 
    或者
           $ hadoop-daemon.sh start namenode 
           $ hadoop-daemon.sh start datanode
    接着启动yarn daemons
           $ start-yarn.sh
    或者
          $ yarn-daemon.sh start resourcemanager 
          $ yarn-daemon.sh start nodemanager
    启动完成后可以进入http://localhost:50070/dfshealth.jsp 查看dfs状态,
  • www.htsjk.Com true http://www.htsjk.com/Hadoop/26096.html NewsArticle ubuntu server 12 上搭建 hadoop2.2 单机伪分布式,ubuntuhadoop2.2 注:我把解压后的hadoop文件重命名为hadoop,放在opt目录下 $ source   /etc/profile $ cd /opt/hadoop/etc/hadoop/ 修改hadoop-env.sh 修改JAVA_HOME,...
    相关文章
      暂无相关文章
    评论暂时关闭