hadoop单节点环境搭建(jdk8+hadoop2.8)
1、java基础环境 jdk8
请自行百度、google
2、配置ssh公钥认证
[配置ssh公钥认证](http://blog.youkuaiyun.com/dark_guo/article/details/72307624)
3、hadoop 安装
下载
[hadoop下载链接](https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/core/)
安装、配置环境变量
1、解压:
tar -zxvf hadoop-2.8.0.tar.gz
cp hadoop-2.8.0.tar.gz /usr/local/hadoop
2、配置环境变量 (添加至: .bashrc)
export HADOOP_HOME=/usr/local/hadoop
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
配置核心文件
conf/core-site.xml
<property>
<name>hadoop.tmp.dir</name>
<value>/Users/guoyakui/app/hadoop/tmp</value>
<description>A base for other temporary directories.</description>
</property>
<-- 配置namenode -->
<property>
<name>fs.default.name</name>
<value>hdfs://192.168.199.139:54310</value>
<description>The name of the default file system. A URI whose
scheme and authority determine the FileSystem implementation. The
uri's scheme determines the config property (fs.SCHEME.impl) naming
the FileSystem implementation class. The uri's authority is used to
determine the host, port, etc. for a filesystem.</description>
</property>
conf/mapred-site.xml
<property>
<name>mapred.job.tracker</name>
<value>192.168.199.139:54311</value>
<description>The host and port that the MapReduce job tracker runs
at. If "local", then jobs are run in-process as a single map
and reduce task.
</description>
</property>
conf/hdfs-site.xml
<property>
<name>dfs.replication</name>
<value>1</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>
格式化 HDFS 文件系统
/usr/local/hadoop/bin/hadoop namenode -format
启动单节点
/usr/local/hadoop/bin/start-all.sh
查看hadoop的运行状态
/usr/local/hadoop$ jps
输出:
12003 SecondaryNameNode
12133 ResourceManager
12232 NodeManager
11786 NameNode
11883 DataNode
14091 Jps
停止服务
bin/stop-all.sh
输出:
Stopping namenodes on [guoyakuidembp.lan]
guoyakuidembp.lan: stopping namenode
localhost: stopping datanode
Stopping secondary namenodes [0.0.0.0]
0.0.0.0: stopping secondarynamenode
stopping yarn daemons
stopping resourcemanager
localhost: stopping nodemanager