HDFS

分布式系统基础架构——Hadoop

跟風遠走 提交于 2019-12-28 05:44:21
1.Hadoop   a.概念:Hadoop是一个由Apache基金会所开发的分布式系统基础架构   b.组成:Hadoop = HDFS (文件系统) + Mapreduce (数据处理) 2.安装   a.配置Java运行环境   b.从官网下载 Hadoop 并解压,地址:http://hadoop.apache.org/releases.html   c.下载 winutils 对 windows 进行支持,地址:https://github.com/steveloughran/winutils(支持老版本)                       https://github.com/zyj108/apache-hadoop-3.1.0-winutils(支持Hadoop3.1.2)   d.解压 winutils 覆盖到 Hadoop 根目录(主要是覆盖bin目录)   e.在 Hadoop 的 etc\hadoop 下,修改如下配置文件     ①修改core-site.xml,配置默认hdfs的访问端口 <configuration> <property> <name>fs.defaultFS</name> <value>hdfs://localhost:9527</value> </property> </configuration>     ②修改hdfs

How to force STORE (overwrite) to HDFS in Pig?

半城伤御伤魂 提交于 2019-12-28 05:39:04
问题 When developing Pig scripts that use the STORE command I have to delete the output directory for every run or the script stops and offers: 2012-06-19 19:22:49,680 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 6000: Output Location Validation Failed for: 'hdfs://[server]/user/[user]/foo/bar More info to follow: Output directory hdfs://[server]/user/[user]/foo/bar already exists So I'm searching for an in-Pig solution to automatically remove the directory , also one that doesn't choke

Append data to existing file in HDFS Java

本小妞迷上赌 提交于 2019-12-28 05:23:23
问题 I'm having trouble to append data to an existing file in HDFS. I want that if the file exists then append a line, if not, create a new file with the name given. Here's my method to write into HDFS. if (!file.exists(path)){ file.createNewFile(path); } FSDataOutputStream fileOutputStream = file.append(path); BufferedWriter br = new BufferedWriter(new OutputStreamWriter(fileOutputStream)); br.append("Content: " + content + "\n"); br.close(); Actually this method writes into HDFS and create a

Append data to existing file in HDFS Java

时间秒杀一切 提交于 2019-12-28 05:23:04
问题 I'm having trouble to append data to an existing file in HDFS. I want that if the file exists then append a line, if not, create a new file with the name given. Here's my method to write into HDFS. if (!file.exists(path)){ file.createNewFile(path); } FSDataOutputStream fileOutputStream = file.append(path); BufferedWriter br = new BufferedWriter(new OutputStreamWriter(fileOutputStream)); br.append("Content: " + content + "\n"); br.close(); Actually this method writes into HDFS and create a

HDFS体系结构简介及优缺点

 ̄綄美尐妖づ 提交于 2019-12-28 04:03:58
HDFS体系结构简介及优缺点 1.1体系结构简介 HDFS是一个主/从(Mater/Slave)体系结构,从最终用户的角度来看,它就像传统的文件系统一样,可以通过目录路径对文件执行CRUD(Create、Read、Update和Delete)操作。但由于分布式存储的性质,HDFS集群拥有一个NameNode和一些DataNode。NameNode管理文件系统的元数据,DataNode存储实际的数据。客户端通过同NameNode和DataNodes的交互访问文件系统。客户端联系NameNode以获取文件的元数据,而真正的文件I/O操作是直接和DataNode进行交互的。 下图为HDFS总体结构示意图 1.1.1 NameNode NameNode可以看作是分布式文件系统中的管理者,主要负责管理文件系统的命名空间、集群配置信息和存储块的复制等。NameNode会将文件系统的Meta-data存储在内存中,这些信息主要包括了文件信息、每一个文件对应的文件块的信息和每一个文件块在DataNode的信息等。l Masterl 管理HDFS的名称空间l 管理数据块映射信息l 配置副本策略l 处理客户端读写请求 1.1.2 Secondary namenode 并非NameNode的热备; 辅助NameNode,分担其工作量; 定期合并fsimage和fsedits,推送给NameNode;

22_Sqoop数据迁移工具

好久不见. 提交于 2019-12-28 02:53:31
Sqoop数据迁移工具 准备: 安装好对应版本的mysql 安装好对应版本的hadoop集群 安装好对应版本的hive 1. Sqoop是什么 Sqoop是apache旗下的一款 ” Hadoop和关系数据库之间传输数据 ”的工具 导入数据 import 将MySQL,Oracle导入数据到Hadoop的HDFS、HIVE、HBASE等数据存储系统 导出数据 export 从Hadoop的文件系统中导出数据到关系数据库 2. Sqoop的工作机制 将导入和导出的命令翻译成mapreduce程序实现 在翻译出的mapreduce中主要是对inputformat和outputformat进行定制 3. Sqoop基本架构 sqoop在发展中的过程中演进出来了两种不同的架构. 架构演变史 sqoop1的架构图 版本号为1.4.x0 sqoop2的架构图 版本号为1.99x为sqoop2 在架构上:sqoop2引入了sqoop server,对connector实现了集中的管理 访问方式:REST API、 JAVA API、 WEB UI以及CLI控制台方式进行访问 4. Sqoop安装部署 Sqoop安装很简单,解压好进行简单的修改就可以使用 1、下载安装包 http://archive.cloudera.com/cdh5/cdh/5/sqoop-1.4.6-cdh5.14.2.tar

There are 0 datanode(s) running and no node(s) are excluded in this operation

别等时光非礼了梦想. 提交于 2019-12-28 01:55:49
问题 I have set up a multi node Hadoop Cluster. The NameNode and Secondary namenode runs on the same machine and the cluster has only one Datanode. All the nodes are configured on Amazon EC2 machines. Following are the configuration files on the master node: masters 54.68.218.192 (public IP of the master node) slaves 54.68.169.62 (public IP of the slave node) core-site.xml <configuration> <property> <name>fs.default.name</name> <value>hdfs://localhost:9000</value> </property> </configuration>

HDFS 命令大全

≡放荡痞女 提交于 2019-12-28 01:44:57
概要 用户命令 dfs 命令 追加文件内容 查看文件内容 得到文件的校验信息 修改用户组 修改文件权限 修改文件所属用户 本地拷贝到 hdfs hdfs 拷贝到本地 获取目录,文件数量及大小 hdfs 内拷贝 createSnapshot 创建快照 deleteSnapshot 删除快照 显示空闲空间 显示文件和目录大小 清空回收站 查找文件 显示目录或文件的访问控制列表 显示文件或目录的扩展信息 ls mkdir moveFromLocal moveToLocal mv rm test tail usage 参考文档 s 概要 HDFS 文件系统的常用操作和普通 Linux 文件系统非常相似,如读取文件,新建目录,移动文件,删除数据,列出目录等。 本文只列出常用的 HDFS 命名,要查看完整的命令行列表,可点击 这里 所有的 HDFS 命令都是调用 bin/hdfs 脚本完成的,它的基本用法如下 hdfs [SHELL_OPTIONS] COMMAND [GENERIC_OPTIONS] [COMMAND_OPTIONS] hdfs 命令分成 3 种类型,分别是 用户命令 集群管理员命令 调试命令(集群管理员使用) 在命令中会有一些 URI 参数,其中 URI 的前缀是由 core-site.xml 中的 fs.defaultFS 决定的,通过该属性就可以知道 namenode

大数据基础之如何导出jar包并放在hdfs上执行

半世苍凉 提交于 2019-12-28 00:27:24
我口才不好,文字描述也不行,但是基本逻辑是通的。 导出jar包 1.首先完成mapper和reducer还有main方法的编码 2。右键点击peopleinfo的包,选择export-》Java-》JAR file,点击NEXT 3.输入jar包名称以及导出地址,点击next->next 4.点击Browse,选择主方法,点击OK,然后点击Finish 放在hdfs上执行 mapreduce的方法 登陆到大数据的VM,前提是已经在该VM中搭建了hdfs的环境输入su - hdfs ,记住-与hdfs有空格 然后执行hadoop jar jar包 数据文件 输出路径 来源: 51CTO 作者: asdud 链接: https://blog.51cto.com/6989066/2326731

hadoop balancer

别等时光非礼了梦想. 提交于 2019-12-27 21:47:39
一、balancer 是当hdfs集群中一些datanodes的存储要写满了或者有空白的新节点加入集群时,用于均衡hdfs集群磁盘使用量的一个工具。这个工具作为一个应用部署在集群中,可以由集群管理员在一个live的cluster中执行。 语法: To start: start-balancer.sh 用默认的10%的阈值启动balancer hfs dfs balancer -threshold 3 start-balancer.sh -threshold 3 指定3%的阈值启动balancer To stop: stop-balancer.sh Threshold参数是1%~100%范围内的一个数,默认值是10%。Threshold参数为集群是否处于均衡状态设置了一个目标。 如果每一个datanode的利用率(已使用空间/节点总容量)和集群利用率(集群已使用空间/集群总容量)不超过Threshold参数值,则认为这个集群是均衡的。 Threshold参数值越小,集群会越均衡。但是以一个较小的threshold值运行balancer带到平衡时花费的时间会更长。同时,如果设置了一个较小的threshold,但是在线上环境中,hadoop集群在进行balance时,还在并发的进行数据的写入和删除,所以有可能无法到达设定的平衡参数值。 基于这些基本点