nginxs

运维博客

hadoop单机版

2016/03/08 22:48 于 数据分析 0

微信 微博 豆瓣 人人


  1. 下载地址:http://apache.fayea.com/hadoop/common/

  2. 解压文件到"/usr/local/hadoop"

3.修改配置文件etc/hadoop/core-site.xml:

<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>

4.etc/hadoop/hdfs-site.xml:

<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>

5.添加无密码登录

$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa  #生成公钥
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys #添加公钥

6.本地运行MapReduce job

   ./bin/hdfs namenode -format            #格式化文件系统
./sbin/start-dfs.sh #启动服务
启动后查看一下 http://localhost:50070/是否全部启动

  ./bin/hdfs dfs -mkdir /user             #创建“/user”目录
./bin/hdfs dfs -mkdir /user/testdir #创建“/user/testdir”目录
./bin/hdfs dfs -put etc/hadoop /user/testdir/ #把当前的“etc”目录下的“hadoop”目录put到hdfs的“/user/testdir/”目录下
./bin/hdfs dfs -get /user/testdir/hadoop /tmp/test/ #把hadoop内的“/user/testdir/hadoop"目录拉到 "/tmp/test/"
./bin/hdfs dfs -ls /user/baishaohua/hadoop/mapred-site.xml.template #查看“hadoop”的目录下文件

-rw-r--r-- 1 root supergroup 758 2016-03-08 22:27 /user/baishaohua/hadoop/mapred-site.xml.template
./bin/hdfs dfs -cat /user/baishaohua/hadoop/mapred-site.xml.template #查看hadoop中文件

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->

<!-- Put site-specific property overrides in this file. -->

<configuration>

</configuration>

微信扫描二维码了解更多 ->

[运维博客]
[运维博客](http://nginxs.blog.51cto.com/

hadoophadoop单机实例hadoop单机

管理