- 浏览: 196456 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
永立s:
这篇博客帮我解决了一个问题,十分感谢.
HBase表增加snappy压缩 -
BlackWing:
日志是job运行日志,看你怎么配置了,一般就在hadoop安装 ...
解决Exception from container-launch: ExitCodeException exitCode=1的另类错误 -
heymaomao:
heymaomao 写道有两个问题,想请教下楼主 第一是日志楼 ...
解决Exception from container-launch: ExitCodeException exitCode=1的另类错误 -
heymaomao:
有两个问题,想请教下楼主 第一是日志楼主到底看的是哪个日志文件 ...
解决Exception from container-launch: ExitCodeException exitCode=1的另类错误 -
atomduan:
本地的Unix 进程创建失败,检查下服务器内存是否够用,是不是 ...
解决Exception from container-launch: ExitCodeException exitCode=1的另类错误
LoadIncrementalHFiles是copy而不是move的疑惑
转载请标明出处:http://blackwing.iteye.com/blog/1991901
之前在另一篇文章里实现的自定义job生成HFile并使用LoadIncrementalHFiles 入库HBase :http://blackwing.iteye.com/blog/1991380
但发现入库时,非常的慢,而且几次都失败了,明明官方教材说这个操作是move的:
再次验证google的强大,发现官方有这个问题的解释:
主要问题是,批量导入HBase时,如果hdfs地址没有写端口,会认为是两个不同文件系统,所以要copy,而如果当是同一文件系统时,则是move,秒级入库了2GB的文件。
指令差别如下:
copy的场景:
move的场景:
剩下的需要好好看看源码增加理解了。
没有secure authentication时,调用流程如下:
其中ProtobufUtil.bulkLoadHFile()代码如下:
其中client是HRegionServer实例。
之后调用过程为:
在HRegionFileSystem.bulkLoadStoreFile(...)这个方法判断源路径、目标路径是否同一个文件系统:
如果不是一个文件系统,那么就调用:
进行拷贝。
最终进行move操作的其实是一个rename操作:
rename函数如下:
之前在另一篇文章里实现的自定义job生成HFile并使用LoadIncrementalHFiles 入库HBase :http://blackwing.iteye.com/blog/1991380
但发现入库时,非常的慢,而且几次都失败了,明明官方教材说这个操作是move的:
The completebulkload utility will move generated StoreFiles into an HBase table. This utility is often used in conjunction with output from Section 15.1.10, “ImportTsv”.
再次验证google的强大,发现官方有这个问题的解释:
https://issues.apache.org/jira/browse/HBASE-9537 https://issues.apache.org/jira/browse/HBASE-8304
主要问题是,批量导入HBase时,如果hdfs地址没有写端口,会认为是两个不同文件系统,所以要copy,而如果当是同一文件系统时,则是move,秒级入库了2GB的文件。
指令差别如下:
copy的场景:
./hbase-0.96.0-hadoop1/bin/hbase org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles hdfs://namenode/outputtsv gonghui_test
move的场景:
./hbase-0.96.0-hadoop1/bin/hbase org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles hdfs://namenode:8020/outputtsv gonghui_test
剩下的需要好好看看源码增加理解了。
没有secure authentication时,调用流程如下:
LoadIncrementalHFiles.doBulkLoad(Path hfofDir, final HTable table) --> LoadIncrementalHFiles.bulkLoadPhase(final HTable table, final HConnection conn,ExecutorService pool, Deque<LoadQueueItem> queue,final Multimap<ByteBuffer, LoadQueueItem> regionGroups) --> LoadIncrementalHFiles.tryAtomicRegionLoad(final HConnection conn,final TableName tableName, final byte[] first, Collection<LoadQueueItem> lqis) --> ProtobufUtil.bulkLoadHFile(final ClientService.BlockingInterface client,final List<Pair<byte[], String>> familyPaths,final byte[] regionName, boolean assignSeqNum) -->
其中ProtobufUtil.bulkLoadHFile()代码如下:
/** * A helper to bulk load a list of HFiles using client protocol. * * @param client * @param familyPaths * @param regionName * @param assignSeqNum * @return true if all are loaded * @throws IOException */ public static boolean bulkLoadHFile(final ClientService.BlockingInterface client, final List<Pair<byte[], String>> familyPaths, final byte[] regionName, boolean assignSeqNum) throws IOException { BulkLoadHFileRequest request = RequestConverter.buildBulkLoadHFileRequest(familyPaths, regionName, assignSeqNum); try { BulkLoadHFileResponse response = client.bulkLoadHFile(null, request); return response.getLoaded(); } catch (ServiceException se) { throw getRemoteException(se); } }
其中client是HRegionServer实例。
之后调用过程为:
HRegionServer --> HRegion.bulkLoadHFiles(...) --> HStore.bulkLoadHFile(...) --> HRegionFileSystem.bulkLoadStoreFile(...)
在HRegionFileSystem.bulkLoadStoreFile(...)这个方法判断源路径、目标路径是否同一个文件系统:
/** * Bulk load: Add a specified store file to the specified family. * If the source file is on the same different file-system is moved from the * source location to the destination location, otherwise is copied over. * * @param familyName Family that will gain the file * @param srcPath {@link Path} to the file to import * @param seqNum Bulk Load sequence number * @return The destination {@link Path} of the bulk loaded file * @throws IOException */ Path bulkLoadStoreFile(final String familyName, Path srcPath, long seqNum) throws IOException { // Copy the file if it's on another filesystem FileSystem srcFs = srcPath.getFileSystem(conf); FileSystem desFs = fs instanceof HFileSystem ? ((HFileSystem)fs).getBackingFs() : fs; // We can't compare FileSystem instances as equals() includes UGI instance // as part of the comparison and won't work when doing SecureBulkLoad // TODO deal with viewFS if (!srcFs.getUri().equals(desFs.getUri())) { LOG.info("Bulk-load file " + srcPath + " is on different filesystem than " + "the destination store. Copying file over to destination filesystem."); Path tmpPath = createTempName(); //不是同一文件系统,则拷贝 FileUtil.copy(srcFs, srcPath, fs, tmpPath, false, conf); LOG.info("Copied " + srcPath + " to temporary path on destination filesystem: " + tmpPath); srcPath = tmpPath; } return commitStoreFile(familyName, srcPath, seqNum, true); }
如果不是一个文件系统,那么就调用:
FileUtil.copy(...)
进行拷贝。
最终进行move操作的其实是一个rename操作:
/** * Move the file from a build/temp location to the main family store directory. * @param familyName Family that will gain the file * @param buildPath {@link Path} to the file to commit. * @param seqNum Sequence Number to append to the file name (less then 0 if no sequence number) * @param generateNewName False if you want to keep the buildPath name * @return The new {@link Path} of the committed file * @throws IOException */ private Path commitStoreFile(final String familyName, final Path buildPath, final long seqNum, final boolean generateNewName) throws IOException { Path storeDir = getStoreDir(familyName); if(!fs.exists(storeDir) && !createDir(storeDir)) throw new IOException("Failed creating " + storeDir); String name = buildPath.getName(); if (generateNewName) { name = generateUniqueName((seqNum < 0) ? null : "_SeqId_" + seqNum + "_"); } Path dstPath = new Path(storeDir, name); if (!fs.exists(buildPath)) { throw new FileNotFoundException(buildPath.toString()); } LOG.debug("Committing store file " + buildPath + " as " + dstPath); // buildPath exists, therefore not doing an exists() check. //在这里进行rename if (!rename(buildPath, dstPath)) { throw new IOException("Failed rename of " + buildPath + " to " + dstPath); } return dstPath; }
rename函数如下:
/** * Renames a directory. Assumes the user has already checked for this directory existence. * @param srcpath * @param dstPath * @return true if rename is successful. * @throws IOException */ boolean rename(Path srcpath, Path dstPath) throws IOException { IOException lastIOE = null; int i = 0; do { try { return fs.rename(srcpath, dstPath); } catch (IOException ioe) { lastIOE = ioe; if (!fs.exists(srcpath) && fs.exists(dstPath)) return true; // successful move // dir is not there, retry after some time. sleepBeforeRetry("Rename Directory", i+1); } } while (++i <= hdfsClientRetriesNumber); throw new IOException("Exception in rename", lastIOE); }
发表评论
-
新版hadoop MultipleOutputs多文件输出
2015-03-11 14:22 3472转载请标明出处:http://blackwing.iteye. ... -
解决直接读HFile时因表数据写入而导致文件目录变化问题
2015-03-02 18:22 1491转载请标明出处:http://blackwing.iteye. ... -
解决Exception from container-launch: ExitCodeException exitCode=1的另类错误
2014-08-21 18:18 23657转载请标明出处:http://blackwing.iteye. ... -
Hadoop生成HFile直接入库HBase心得
2013-12-18 16:15 5196转载请标明出处:http://blackwing.iteye. ... -
NullPointerException SerializationFactory.getSerializer解决
2013-12-04 17:30 1587转载请标明出处:http://blackwing.iteye. ... -
Hadoop的Text类getBytes字节数据put到HBase后有多余字符串问题
2013-11-21 15:53 2099转载请标明出处:http://blackwing.iteye. ... -
编译YCSB 解决Not a host:port pair问题
2013-09-18 17:25 1928转载请标明出处:http://blackwing.iteye. ... -
HBase使用SNAPPY压缩遇到compression test fail问题解决
2013-09-18 10:51 10782转载请标明出处:http://blackwing.iteye. ... -
HBase表增加snappy压缩
2013-09-13 17:54 4292转载请标明来源:http://blackwing.iteye. ... -
hadoop 1.0.3增加snappy压缩
2013-09-11 17:27 1767转载请标明来源:http://blackwing.iteye. ... -
把hadoop的metrics加入ganglia监控
2013-09-04 17:02 1545hadoop的metrics加入ganglia其实是很简单的, ... -
ROOT不在线的另外一种原因及解决办法
2013-07-29 14:28 1460转载请声明出处:http://blackwing.iteye. ... -
enable和disable表时出现表未disable/enable异常处理
2013-07-29 11:42 4892转载请标明出处:http://blackwing.iteye. ... -
MultithreadedMapper多线程读取数据
2013-04-27 15:51 0由于当前业务需求读取HBase表时,会存在数据倾斜,大部分数据 ... -
shuffle & sort解释
2013-04-16 17:31 1209转载请标明出处:http://blackwing.iteye. ... -
hadoop的 IncompatibleClassChangeError
2013-02-06 17:26 2048开发环境中,使用的是官方版的hadoop 1.0.1版,而集群 ... -
HBase的start key和end key疑惑
2013-02-05 15:57 4858转载请标明来源:http://blackwing.iteye. ... -
HBase的coprocessor分拆HRegion
2013-02-04 15:15 3269引用转载请注明出处,文章链接:http://blackwing ... -
分拆TableSplit 让多个mapper同时读取
2013-01-06 18:13 2548默认情况下,一个region是一个tableSplit,对应一 ... -
GET查询HBase无结果时 Result的size也不为空
2012-11-28 11:15 2030用Get查询hbase某个row时,就算该row不存在,但还是 ...
相关推荐
accelerated Copy move forgery detection by using matlab path .
DWT-PCA (EVD) Based Copy-move Image Forgery Detection
快速copy&move处理文件,同一或不同硬盘,USB手指。复制或移动更快完成任务。 绝对好用~ 适合任何windows
copy-move 类型的篡改检测,原作者为意大利人。
copy move forgery detection matlab program mand source code
基于KAZE 抗平滑纹理的复制粘贴篡改检测,董晓旭,杨高波,针对部分篡改图像明显的光线变换、纹理单一提取点不足的检测效果差的问题,本文提出基于直方图均衡化预处理和KAZE特征的高效复制粘�
针对图像盲认证中一种常见的Copy-Move型图像篡改,提出了基于图像的Tamura纹理特征的Copy-Move型篡改区域的检测和定位算法。该算法提取每一图像块的Tamura纹理特征组成图像的特征向量,用字典排序法对特征向量进行...
这是一篇关于图像质量评价的文章,供研究者下载,而且无需积分噢哦哦
用zernike矩的方法,对复制粘贴区域进行旋转不变定位
Copy-move盲检测中SIFT与SURF算法比较,王心怡,杨正洪,数字图像的篡改方式有很多种,其中copy-move(复制粘贴)是通过将同幅图像中的一块区域复制粘贴到其他区域实现对图像的篡改,该篡改容�
可以实现图像篡改检测,附带有几张图片,检测效果一般
一种基于局部Hu矩的图像Copy-Move篡改取证方法.pdf
基于DCT聚类分析的数字图像Copy-Move篡改检测,韩栖林,余瑾,针对数字图像Copy-Move篡改,提出了一种有效检测与定位篡改区域的算法。算法利用K-means聚类方法对子块DCT特征进行聚类分析,大大缩小��
基于区域时域特性的视频Copy-Move检测,王康,蒋兴浩,视频复制篡改操作是一种较为有效而常见的篡改方式,通过此种方式可以达到掩盖、添加或者平移目标等目的,具体操作是以视频帧内内
Fastcopy是一款速度非常快的文件拷贝软件。 参数: /cmd=(noexist_only|diff|update| sync|force_copy|move|delete) .../symlink 用象征性连接(而不是本质)拷贝象征性连接其本身(在/symlink=FALSE拷贝本质)
并且这些步骤都是多个线程同时进行的,如果线程之间的协同运作不够完美,那速度就会大打折扣,有些线程忙得要命,而有些却必须等待,FASTCOPY就是优化了它们之间的工作顺序,大大提高了速度。 使用说明: 启动...
问题:ssh-copy-id 命令无法使用,在linux服务器的ssh服务中没有有这个命令,可以在/usr/bin/的这文件夹中查看没有这个ssh-copy-id 命令。 问题分析:是由于ssh服务的问题,可以直接将ssh-copy-id 命令拷贝/usr/...
文件copy 目录copy
OC-NSString为什么用copy修饰而不是用strong
克隆(复制移动伪造)是恶意的对数字图像进行篡改攻击,将图像的一部分复制并粘贴到图像中,以隐藏图像的重要细节,而没有任何明显的篡改痕迹。 这种类型的篡改攻击给取证留下了一个关于图像真实性的大问题。 在开发...