首页 > 代码库 > Hadoop1.2.1伪分布模式安装指南
Hadoop1.2.1伪分布模式安装指南
一、前置条件
(1)Linux可以用作开发平台及产品平台。
2、安装jdk 1.6或以上
$ ssh-keygen -t dsa -P ‘‘ -f ~/.ssh/id_dsa
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
二、基本准备
[plain] view plaincopy
- [root@jediael jediael]$wget http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-1.2.1/hadoop-1.2.1.tar.gz
- root@jediael jediael]$ tar -zxvf hadoop-1.2.1-bin.tar.gz
2、修改conf/hadoop-env.sh,添加JAVA_HOME变量
增加JAVA_HOME
- export JAVA_HOME=/usr/java/jdk1.7.0_51
[plain] view plaincopy
- [root@jediael hadoop-1.2.1]$ bin/hadoop
- Usage: hadoop [--config confdir] COMMAND
- where COMMAND is one of:
- namenode -format format the DFS filesystem
- secondarynamenode run the DFS secondary namenode
- namenode run the DFS namenode
- datanode run a DFS datanode
- dfsadmin run a DFS admin client
- mradmin run a Map-Reduce admin client
- fsck run a DFS filesystem checking utility
- fs run a generic filesystem user client
三、配置伪分布模式
<configuration> <property> <name>fs.default.name</name> <value>hdfs://localhost:9000</value> </property></configuration>
<configuration> <property> <name>dfs.replication</name> <value>1</value> </property></configuration>
3、配置mapred-site.xml,增加以下属性
<configuration> <property> <name>mapred.job.tracker</name> <value>localhost:9001</value> </property> </configuration>
四、启动hadoop
[plain] view plaincopy
- [root@jediael hadoop-1.2.1]$ bin/hadoop namenode -format
- 14/08/16 23:50:02 INFO namenode.NameNode: STARTUP_MSG:
- /************************************************************
- STARTUP_MSG: Starting NameNode
- STARTUP_MSG: host = jediael/10.171.29.191
- STARTUP_MSG: args = [-format]
- STARTUP_MSG: version = 1.2.1
- STARTUP_MSG: build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.2 -r 1503152; compiled by ‘mattf‘ on Mon Jul 22 15:23:09 PDT 2013
- STARTUP_MSG: java = 1.7.0_51
- ************************************************************/
- 14/08/16 23:50:02 INFO util.GSet: Computing capacity for map BlocksMap
- 14/08/16 23:50:02 INFO util.GSet: VM type = 64-bit
- 14/08/16 23:50:02 INFO util.GSet: 2.0% max memory = 1013645312
- 14/08/16 23:50:02 INFO util.GSet: capacity = 2^21 = 2097152 entries
- 14/08/16 23:50:02 INFO util.GSet: recommended=2097152, actual=2097152
- 14/08/16 23:50:02 INFO namenode.FSNamesystem: fsOwner=jediael
- 14/08/16 23:50:02 INFO namenode.FSNamesystem: supergroup=supergroup
- 14/08/16 23:50:02 INFO namenode.FSNamesystem: isPermissionEnabled=true
- 14/08/16 23:50:02 INFO namenode.FSNamesystem: dfs.block.invalidate.limit=100
- 14/08/16 23:50:02 INFO namenode.FSNamesystem: isAccessTokenEnabled=false accessKeyUpdateInterval=0 min(s), accessTokenLifetime=0 min(s)
- 14/08/16 23:50:02 INFO namenode.FSEditLog: dfs.namenode.edits.toleration.length = 0
- 14/08/16 23:50:02 INFO namenode.NameNode: Caching file names occuring more than 10 times
- 14/08/16 23:50:03 INFO common.Storage: Image file /tmp/hadoop-jediael/dfs/name/current/fsimage of size 113 bytes saved in 0 seconds.
- 14/08/16 23:50:03 INFO namenode.FSEditLog: closing edit log: position=4, editlog=/tmp/hadoop-jediael/dfs/name/current/edits
- 14/08/16 23:50:03 INFO namenode.FSEditLog: close success: truncate to 4, editlog=/tmp/hadoop-jediael/dfs/name/current/edits
- 14/08/16 23:50:03 INFO common.Storage: Storage directory /tmp/hadoop-jediael/dfs/name has been successfully formatted.
- 14/08/16 23:50:03 INFO namenode.NameNode: SHUTDOWN_MSG:
- /************************************************************
- SHUTDOWN_MSG: Shutting down NameNode at jediael/10.171.29.191
- ************************************************************/
[plain] view plaincopy
- [root@jediael hadoop-1.2.1]# bin/start-all.sh
- starting namenode, logging to /opt/jediael/hadoop-1.2.1/libexec/../logs/hadoop-root-namenode-jediael.out
- localhost: starting datanode, logging to /opt/jediael/hadoop-1.2.1/libexec/../logs/hadoop-root-datanode-jediael.out
- localhost: starting secondarynamenode, logging to /opt/jediael/hadoop-1.2.1/libexec/../logs/hadoop-root-secondarynamenode-jediael.out
- starting jobtracker, logging to /opt/jediael/hadoop-1.2.1/libexec/../logs/hadoop-root-jobtracker-jediael.out
- localhost: starting tasktracker, logging to /opt/jediael/hadoop-1.2.1/libexec/../logs/hadoop-root-tasktracker-jediael.out
如何设置普通用户的ssh免密码用户登录?同样方法不成功,sudo也不成功。待解决。
默认情况下,日志将被输出至{HADOOP_HOME}/logs,除非修改了${HADOOP_LOG_DIR}。
3、访问以下2个页面,验证是否已经安装成功
- NameNode - http://localhost:50070/
- JobTracker - http://localhost:50030/
[plain] view plaincopy
- [root@jediael hadoop-1.2.0]# jps
- 3148 JobTracker
- 3280 TaskTracker
- 3052 SecondaryNameNode
- 2920 DataNode
- 2801 NameNode
- 3442 Jps
五、使用一个简单的hadoop程序验证环境
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。