Hadoop配置文件

/etc/profile

配置Java和Hadoop环境

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export HADOOP_HOME=/usr/local/hadoop-2.6.5/hadoop-2.6.5
export PATH=$JAVA_HOME/bin:${PATH}:$HADOOP_HOME/bin:$HADOOP_HOME/sbin

配置文件在/etc/hadoop

core-site.xml

fs.defualtFS:配置主节点namenode地址

hadoop.tmp.dir:在本地文件系统所在的NameNode的存储空间和持续化处理日志

<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://192.168.94.140:9000</value>
</property> <property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop-2.6.5/data</value>
</property>
</configuration>

mapred-site.xml.template

mapreduce.framework.name:执行框架设置为 Hadoop YARN

<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>

yarn-site.xml

yarn.resourcemanager.hostname:namenode的yarn地址

yarn.nodemanager.aux-services:Shuffle service 需要加以设置的Map Reduce的应用程序服务

<property>
<name>yarn.resourcemanager.hostname</name>
<value>CentOS7One</value>
</property> <property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>

hadoop-env.sh

JAVA_HOME换成绝对路径

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk

slaves

配置子节点,伪分布式,一台机器,配置子节点为自身

CentOS7One

Hadoop免密钥配置

方法1:

1.生成私钥和公钥

[root@CentOS7One ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
eb:::dc:9a::ee:f9:5d:3b:db:6f::::f9 root@CentOS7One
The key's randomart image is:
+--[ RSA ]----+
| .|
| ..|
| . . o.|
| + o o E|
| B S o |
| o o . .|
| . o. . . |
| +o . ..o o|
| ...o . oo.+.|
+-----------------+

2.将CentOS7One的id_rsa_pub拷贝到CentOSTwo中

[root@CentOS7One .ssh]#
[root@CentOS7One .ssh]# scp id_rsa.pub CentOS7Two:/root
The authenticity of host 'centos7two (192.168.94.139)' can't be established.
ECDSA key fingerprint is dd:e2::9d:e2:6e::c3:2a:::3f:f6:3a:f2:.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'centos7two,192.168.94.139' (ECDSA) to the list of known hosts.
root@centos7two's password:
id_rsa.pub % .4KB/s :
[root@CentOS7One .ssh]#

3.重复步骤1,在CentOS7Two主机上生成私钥和公钥

[root@CentOS7Two ~]# ssh-keygen -t rsa

4.在CentOS7Two中新建authorized_keys,权限为600,向其追加从CentOS7One拷贝的id_rsa.pub

[root@CentOS7Two .ssh]# touch authorized_keys
[root@CentOS7Two .ssh]# chmod authorized_keys
[root@CentOS7Two .ssh]# cat /root/id_rsa.pub >> authorized_keys

authorized_keys是被允许免密连接到CentOS7Two的主机的公钥

[root@CentOS7Two .ssh]# cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGBMCc2AOqbMUT9uB8tDyrcNkjV/nCum/Ez5OMRZlVEITERtMLN8NUZP0kQjqiRU7kr5oIlA8FoE6sgSF7ciTu1IIDb2pg3roe0PpcaIwdSjP/b6ktnnkkcIXl74194AY/I+A9UFGErdaarTzAlMEougMC6G9IYTefqyMywsUZ5lH3PP72vqQNwZZX/LZtq6AK+yZ4C2jiErfF3i7hL1bTxVDBvGmLg37U8xNhei0Z5SDq9tCGP9EFabVuaw+mehPxGwFTbyuQj6X1xDmRD8lfjRWTK7M88dVImKdrf85KJAL5kyquIQi0tSAskkSlaroIDzNh1ebacKlOuWh6eWhd root@CentOS7One

方法2:

先在本机上生成私钥和公钥

[root@CentOS7Three ~]# ssh-keygen -t rsa

然后,运行ssh-copy-id命令,快捷的配置免密登录

[root@CentOS7Three ~]# ssh-copy-id CentOS7Seven

Hadoop运行

Hadoop格式化

对Hadoop格式化,对data目录下写初始化文件

hadoop namenode -format

启动dfs

启动目录在sbin/

start-dfs.sh

Jps检验是否启动成功

[root@CentOS7One current]# jps
NameNode
DataNode
SecondaryNameNode
Jps

启动yarn

start-yarn.sh

Jps检验是否成功

[root@CentOS7One current]# jps
NameNode
DataNode
NodeManager
SecondaryNameNode
ResourceManager
Jps

Hadoop命令

上传

hadoop fs -put hadoop-2.6..tar.gz hdfs://CentOS7One:9000/
hadoop fs -copyFromLocal /usr/local/hadoop-2.6.5/hadoop-2.6.5/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.5.jar /

下载

hadoop fs -get hdfs://CentOS7One:9000/hadoop-2.6.5.tar.gz 

创建文件

路径是hdfs://CenOS7One:9000/wordcount/input的简写

hadoop fs -mkdir /wordcount/input

查看文件列表

[root@CentOS7One mapreduce]# hadoop fs -ls /wordcount/output
Found items
-rw-r--r-- root supergroup -- : /wordcount/output/_SUCCESS
-rw-r--r-- root supergroup -- : /wordcount/output/part-r-

查看文件详情

[root@CentOS7One mapreduce]# hadoop fs -cat /wordcount/output/part-r-
fuckbaby
hello
jim
kitty
tom
world

删除文件

[root@CentOS7One ~]# hadoop fs -rm -r /qingshu.txt
// :: INFO fs.TrashPolicyDefault: Namenode trash configuration: Deletion interval = minutes, Emptier interval = minutes.
Deleted /qingshu.txt

查看文件系统空间使用情况

[root@CentOS7One data]# hadoop fs -df -h /
Filesystem Size Used Available Use%
hdfs://192.168.94.140:9000 17.5 G 210.6 M 14.1 G 1%

查看文件夹、文件具体占用多少空间

[root@CentOS7One data]# hadoop fs -du -s -h hdfs://CentOS7One:9000/*
190.4 M hdfs://CentOS7One:9000/hadoop-2.6.5.tar.gz
285.8 K hdfs://CentOS7One:9000/hadoop-mapreduce-examples-2.6.5.jar
18.1 M hdfs://CentOS7One:9000/mapreduce
hdfs://CentOS7One:9000/user
hdfs://CentOS7One:9000/wordcount

CentOS7.2配置Hadoop2.6.5的更多相关文章

  1. Centos7.0配置Hadoop2.7.0伪分布式

    一.ssh免密登录 1.命令ssh-keygen. overwrite输入y一路回车 2.将生成的密钥发送到本机 ssh-copy-id localhost中间会询问是否继续输入“yes” 3.测试免 ...

  2. building hadoop2.4.1 on centos7[在centos7上面构建hadoop2.4.1]

    本文介绍在centos7上面通过hadoop2.4.1源码构建hadoop distribution 版本,即hadoop的运行版本. 为何要自己building,而不用Apache的distribu ...

  3. Centos7网络配置,vsftpd安装及530报错解决

    今天在虚拟机安装CentOS7,准备全新安装LTMP,结果又是一堆问题,不过正好因为这些出错,又给自己长了见识. 1,CentOS7网络配置 最小化安装CentOs7后,ifconfig提示comma ...

  4. Centos7安装配置gitlab

    Centos7安装配置gitlab 这篇文字我会介绍在Centos7上安装gitlab,配置gitlab的smtp,并且创建项目demo. sudo yum install openssh-serve ...

  5. VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装

    VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装在阿里云开源镜像地址下载镜像Index of /centos/7.2.1511/isos/x86_64/http://mirro ...

  6. centos7初步配置

    centos7初步配置 首先安装lrzsz zip/unzip yum -y install lrzsz yum -y install zip unzip 安装vim yum install vim* ...

  7. centos7网络配置总结

    centos7网络配置 --wang 一.通过配置文件 配置/etc/sysconfig/network-scripts/en.. 记忆信息量大,易出错,不推荐使用.配置多台电脑静态ip可以通过复制模 ...

  8. CentOS7基本配置一

    CentOS7基本配置一 安装VMwareTools 1.点击重新安装VM-tool, 继而找到压缩文件VMwareTools-10.2.0...tar.gz,复制到桌面下,解压这么压缩文件到桌面下 ...

  9. Centos7安装配置Apache+PHP+Mysql+phpmyadmin

    转载自: Centos7安装配置Apache+PHP+Mysql+phpmyadmin 一.安装Apache yum install httpd 安装成功后,Apache操作命令: systemctl ...

随机推荐

  1. 在TFS持续集成(持续发布)中执行Telnet任务

    Telnet是一种在因特网或局域网上使用虚拟终端连接,提供双向交互式文本通信设备的协议. 它是最早的互联网通讯协议之一.自1969年启用以来,已经经过了将近50年时间,在开放式的操作系统中拥有广泛的用 ...

  2. dorado-menu

    1.menu控件是一个下拉菜单控件,可以设置数icon(图标),click事件,Dorado事件中都有self和arg两个参数,其中self是当前控件本身 2.menu控件可以和toolBar结合使用 ...

  3. 从 exe.config 读取appSettings 中的配置数据

    右键解决方案,添加引用--> System.Configuration.dll 在exe.config 中添加数据 <appSettings> <add key=" ...

  4. Python:Selenium+Webdriver安装

    本人小白一枚,今天在使用selenium+webdriver的时候遇到了一个小问题: WebDriverException: 'chromedriver' executable needs to be ...

  5. DevExpress WinForms Controls 学习系列1

    一个偶然的机会,接触到DevExpress.项目是WinForm的,应用了DevExpress.为了使项目具备维护开发的生命力,我觉得有必要系统的学习一下DevExpress,今天是学习笔记的第一篇. ...

  6. 违反了引用完整性约束。Dependent Role 具有多个具有不同值的主体。S级乌龙,自己制造的笑话

    项目中碰到一个错误,捯饬了一个半小时没解决,吃完饭继续搞~ EF新增多表管理数据时报错:违反了引用完整性约束.Dependent Role 具有多个具有不同值的主体. 最终问题解决后,完全是因为自己的 ...

  7. 盘点Xcode中开发者最喜爱的十大开源插件

    Xcode IDE拥有着诸如导航.重构.校准等众多非常高大上的工具,而予以辅助的插件更是在Xcode的基础上对相关功能进行改进与扩展.在应用开发过程中,通过开源包管理器Alcatraz对插件进行安装管 ...

  8. 面向对象进阶-类的内置方法 __str__ 、__repr__、__len__、__del__、__call__(三)

    # 内置的类方法 和 内置的函数之间有着千丝万缕的联系# 双下方法# obj.__str__ str(obj)# obj.__repr__ repr(obj) # def __str__(self): ...

  9. Mac OSX sublime text2 各种快捷键

    Mac 快捷键 https://support.apple.com/zh-cn/HT201236 Preferences -> Key Bindings - User [ { "key ...

  10. spring-security(2)

    记录一下spring security的配置 配置详解 <?xml version="1.0" encoding="UTF-8"?> <bea ...