Hadoop 单机节点集群安装(2)

设置JDK:
vi .profile
export Java_HOME=/jdk1.6
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

设置Hadoop
修改conf/hadoop-env.sh:export JAVA_HOME=jdk1.6
修改hadoop核心配置文件core-site.xml ,这里配置的是HDFS的地址和端口:
vi conf/core-site.xml

<configuration>  

<property>   

      <name>fs.default.name</name>   

       <value>hdfs://localhost:9000</value>   

</property>  

<property>   

       <name>dfs.replication</name>   

       <value>1</value>   

</property>  

<property>   

       <name>hadoop.tmp.dir</name>   

       <value>/home/hadoop/tmp</value>   

</property>  

</configuration>

修改hadoop中HDFS的配置hdfs-site.xml,配置的备份方式默认为3,因为安装的是单机版,所以修改为1

vi conf/hdfs-site.xml

<configuration>  

<property>  

     <name>dfs.replication</name>  

     <value>1</value>  

</property>  

</configuration> 

修改hadoop中MapReduce的配置文件maprd-site.xml,配置的是JobTracker的地址和端口:
vi conf/maprd-site.xml

<configuration>  

<property>  

     <name>mapred.job.tracker</name>  

     <value>localhost:9001</value>  

</property>  

</configuration> 

启动hadoop,在启动之前,需要格式化hadoop的文件系统HDFS,进度hadoop文件夹,输入下面命令:
bin/hadoop namenode -format

root@Ubuntu:/hadoop-1.1.0/bin# ./hadoop namenode -format
12/10/29 18:54:58 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:  host = ubuntu/127.0.1.1
STARTUP_MSG:  args = [-format]
STARTUP_MSG:  version = 1.1.0
STARTUP_MSG:  build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.1 -r 1394289; compiled by 'hortonfo' on Thu Oct  4 22:06:49 UTC 2012
************************************************************/
12/10/29 18:54:58 INFO util.GSet: VM type      = 32-bit
12/10/29 18:54:58 INFO util.GSet: 2% max memory = 19.33375 MB
12/10/29 18:54:58 INFO util.GSet: capacity      = 2^22 = 4194304 entries
12/10/29 18:54:58 INFO util.GSet: recommended=4194304, actual=4194304
12/10/29 18:54:59 INFO namenode.FSNamesystem: fsOwner=root
12/10/29 18:54:59 INFO namenode.FSNamesystem: supergroup=supergroup
12/10/29 18:54:59 INFO namenode.FSNamesystem: isPermissionEnabled=true
12/10/29 18:54:59 INFO namenode.FSNamesystem: dfs.block.invalidate.limit=100
12/10/29 18:54:59 INFO namenode.FSNamesystem: isAccessTokenEnabled=false accessKeyUpdateInterval=0 min(s), accessTokenLifetime=0 min(s)
12/10/29 18:54:59 INFO namenode.NameNode: Caching file names occuring more than 10 times
12/10/29 18:54:59 INFO common.Storage: Image file of size 110 saved in 0 seconds.
12/10/29 18:55:00 INFO namenode.FSEditLog: closing edit log: position=4, editlog=/tmp/hadoop-root/dfs/name/current/edits
12/10/29 18:55:00 INFO namenode.FSEditLog: close success: truncate to 4, editlog=/tmp/hadoop-root/dfs/name/current/edits
12/10/29 18:55:00 INFO common.Storage: Storage directory /tmp/hadoop-root/dfs/name has been successfully formatted.
12/10/29 18:55:00 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at ubuntu/127.0.1.1
************************************************************/
root@ubuntu:/hadoop-1.1.0/bin#

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/c93de893317137584cc1f5857ce87bce.html