查看HBase表在HDFS中的文件结构

HBase和HDFS的关系 问题:关系数据库已经流行很多年,并且Hadoop已经有了HDFS和MapReduce,为什么需要HBase? 1、首先了解一下 HDFS文件存储系统和HBASE分布式数据库 HDFS是Hadoop分布式文件系统。 HBase的数据通常存储在HDFS上。HDFS为HBase提供了高可靠性的底层存储支持。 Hbase是Hadoop database即Hadoop数据库。它是一个适合于非结构化数据... 阅读详情
问题导读:
1.hdfs中的建立的目录. 表与目录的关系式什么?一个表是否对应一个目录?
2.-ROOT-表和.META对应几个文件?
3.splitlog和.corrupt目录是用来做什么的?
4.通过http查看文件,需要配置那个文件?






为了查看HBASE表在HDFS中的文件结构.
在HBASE中建立一张表结构如下:

  1. {NAME => 'USER_TEST_TABLE',   
  2. MEMSTORE_FLUSHSIZE => '67108864',   
  3. MAX_FILESIZE => '1073741824',   
  4. FAMILIES => [  
  5. {NAME => 'info', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0',   
  6. COMPRESSION => 'NONE', VERSIONS => '1', TTL => '2147483647',   
  7. BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'  
  8. },   
  9. {NAME => 'info2', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0',   
  10. COMPRESSION => 'NONE', VERSIONS => '1', TTL => '2147483647',   
  11. BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'  
  12. }  
  13. ]  
  14. }  
复制代码


结构图如下, 往下表插入测试数据, 下面查看此表在HDFS中文件的存储方式.
 

由于在HBase服务器配置文件中指定的存储HBase文件的HDFS地址为:
hdfs://HADOOPCLUS01:端口/hbase
登录到namenode服务器,这里为HADOOPCLUS01, 用hadoop命令查看hbase在hdfs中此表的文件.

1. 查看Hbase根目录. 
  1. [hadoop@HADOOPCLUS01 bin]$ hadoop fs -ls hadoop fs -ls /hbase
  2. Found 37 items
  3. drwxr-xr-x   - hadoop cug-admin          0 2013-03-27 09:29 /hbase/-ROOT-
  4. drwxr-xr-x   - hadoop cug-admin          0 2013-03-27 09:29 /hbase/.META.
  5. drwxr-xr-x   - hadoop cug-admin          0 2013-03-26 13:15 /hbase/.corrupt
  6. drwxr-xr-x   - hadoop cug-admin          0 2013-03-27 09:48 /hbase/.logs
  7. drwxr-xr-x   - hadoop cug-admin          0 2013-03-30 17:49 /hbase/.oldlogs
  8. drwxr-xr-x   - hadoop cug-admin          0 2013-03-30 17:49 /hbase/splitlog
  9. drwxr-xr-x   - hadoop cug-admin          0 2013-03-30 17:49 /hbase/USER_TEST_TABLE
复制代码


可以看到所有表的信息. 在hdfs中的建立的目录. 一个表对应一个目录.
-ROOT-表和.META.表也不例外, -ROOT-表和.META.表都有同样的表结构, 关于两表的表结构和怎么对应HBase整个环境的表的HRegion, 可以查看上篇转载的文章.
splitlog和.corrupt目录分别是log split进程用来存储中间split文件的和损坏的日志文件的。
.logs和.oldlogs目录为HLog的存储.
.oldlogs为已经失效的HLog(Hlog对HBase数据库写Put已经全部完毕), 后面进行删除.
HLog File 是一个Sequence File,HLog File 由一条条的 HLog.Entry构成。可以说Entry是HLog的基本组成部分,也是Read 和Write的基本单位。
Entry由两个部分组成:HLogKey和WALEdit。


2. 查看建立表hdfs目录内容:
  1. [hadoop@HADOOPCLUS01 bin]$ hadoop fs -ls /hbase/USER_TEST_TABLE
  2. Found 2 items
  3. drwxr-xr-x   - hadoop cug-admin          0 2013-03-28 10:18 /hbase/USER_TEST_TABLE/03d99a89a256f0e09d0222709b1d0cbe
  4. drwxr-xr-x   - hadoop cug-admin          0 2013-03-28 10:18 /hbase/USER_TEST_TABLE/68b8ad74920040ba9f39141e908c67ce
复制代码


有两个目录, 说明此表已经分裂成两个HRegion.


3. 在查看其中一个HRegion的文件目录.
  1. [hadoop@HADOOPCLUS01 bin]$ hadoop fs -ls /hbase/USER_TEST_TABLE/68b8ad74920040ba9f39141e908c67ce
  2. Found 4 items
  3. -rw-r--r--   3 hadoop cug-admin       1454 2013-03-28 10:18 /hbase/USER_TEST_TABLE/68b8ad74920040ba9f39141e908c67ce/.regioninfo
  4. drwxr-xr-x   - hadoop cug-admin          0 2013-03-29 15:21 /hbase/USER_TEST_TABLE/68b8ad74920040ba9f39141e908c67ce/.tmp
  5. drwxr-xr-x   - hadoop cug-admin          0 2013-03-29 15:21 /hbase/USER_TEST_TABLE/68b8ad74920040ba9f39141e908c67ce/info
  6. drwxr-xr-x   - hadoop cug-admin          0 2013-03-28 10:18 /hbase/USER_TEST_TABLE/68b8ad74920040ba9f39141e908c67ce/info2
复制代码



.regioninfo 此HRegion的信息. StartRowKey, EndRowKey. 记录Region在表中的范围信息.
info, info2, 两个ColumnFamily.  为两个目录.


4. 再对.regioninfo文件用cat查看内容:
乱码已经过滤, 存储的信息整理:
  1. [hadoop@HADOOPCLUS01 bin]$ hadoop fs -cat /hbase/USER_TEST_TABLE/68b8ad74920040ba9f39141e908c67ce/.regioninfo
  2. USER_TEST_TABLE,AAA-AAA11110UC1,1364437081331.68b8ad74920040ba9f39141e908c67ce.
  3. AA-AAA11110UC1
  4. USER_TEST_TABLE

  5. IS_ROOT false
  6. IS_META false
  7. MAX_FILESIZE 1073741824
  8. MEMSTORE_FLUSHSIZ 6710886

  9. info
  10. BLOOMFILTER NONE 
  11. REPLICATION_SCOPEVERSIONS 1
  12. COMPRESSION NONE
  13. TTL 2147483647
  14. BLOCKSIZE 65536  
  15. IN_MEMORY false
  16. BLOCKCACHE true

  17. info2
  18. BLOOMFILTER NONE 
  19. REPLICATION_SCOPEVERSIONS 1
  20. COMPRESSION NONE
  21. TTL 2147483647
  22. BLOCKSIZE 65536
  23. IN_MEMORY false
  24. BLOCKCACHE true

  25. REGION => {NAME => 'USER_TEST_TABLE,\x00\x00\x00\x0A\x00\x00\x00\x09AAA-AAA11110UC1\x00\x00\x00\x00,
  26. 1364437081331.68b8ad74920040ba9f39141e908c67ce.', 
  27. STARTKEY => '\x00\x00\x00\x0A\x00\x00\x00\x09AAA-AAA11110UC1\x00\x00\x00\x00', 
  28. ENDKEY => '', 
  29. ENCODED => 68b8ad74920040ba9f39141e908c67ce, 
  30. TABLE => {{NAME => 'USER_TEST_TABLE', MAX_FILESIZE => '1073741824', 
  31. MEMSTORE_FLUSHSIZE => '67108864', 
  32. FAMILIES => [{NAME => 'info', BLOOMFILTER => 'NONE', 
  33. REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', 
  34. TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', 
  35. BLOCKCACHE => 'true'}, 
  36. {NAME => 'info2', BLOOMFILTER => 'NONE', 
  37. REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', 
  38. TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', 
  39. BLOCKCACHE => 'true'}]}}
  40. VT102VT102VT102VT102VT102VT102VT102VT102
复制代码

5. 查看info ColumnFamily中信息文件和目录:

  1. [hadoop@HADOOPCLUS01 bin]$ hadoop fs -ls /hbase/USER_TEST_TABLE/68b8ad74920040ba9f39141e908c67ce/info  
  2. Found 4 items  
  3. -rw-r--r--   3 hadoop cug-admin  547290902 2013-03-28 10:18 /hbase/USER_TEST_TABLE/68b8ad74920040ba9f39141e908c67ce/info/4024386696476133625  
  4. -rw-r--r--   3 hadoop cug-admin  115507832 2013-03-29 15:20 /hbase/USER_TEST_TABLE/68b8ad74920040ba9f39141e908c67ce/info/5184431447574744531  
  5. -rw-r--r--   3 hadoop cug-admin  220368457 2013-03-29 15:13 /hbase/USER_TEST_TABLE/68b8ad74920040ba9f39141e908c67ce/info/6150330155463854827  
  6. -rw-r--r--   3 hadoop cug-admin   24207459 2013-03-29 15:21 /hbase/USER_TEST_TABLE/68b8ad74920040ba9f39141e908c67ce/info/7480382738108050697  
复制代码
6. 查看具体保存HBase数据的HDFS文件信息:
  1. [hadoop@HADOOPCLUS01 bin]$ hadoop fs -cat /hbase/USER_TEST_TABLE/68b8ad74920040ba9f39141e908c67ce/info/4024386696476133625
  2. AA-AAA11110UDFinfoChangeType=2 13560596974000
  3. AA-AAA11110UDFinfoCountry=1 13560596974000
  4. AA-AAA11110UDFinfoUpdateTime=13560596974105 13560596974000

  5. AA-AAA11110UDGinfoChangeType=2 13560596974000
  6. AA-AAA11110UDGinfoCountry=1 13560596974000
  7. AA-AAA11110UDGinfoUpdateTime=13560334347205 13560596974000

  8. AA-AAA11110UDHinfoChangeType=2 13560596974000
  9. AA-AAA11110UDHinfoCountry=1 13560596974000
  10. AA-AAA11110UDHinfoUpdateTime=13560281517235 13560596974000
复制代码


即是上面图片中插入的其中一部分数据.
在HBase中存储时, 对于每个Qualifer有如下5个属性RowKey, ColumnFamily, Qualifer, TimeStamp, Value.
  1. AA-AAA11110UDFinfoCountry=1 13560596974000
复制代码
# AA-AAA11110UDH 部分对应RowKey;
   # info对应了ColumnFamily;
   # Country对应Qualifer;
   # 1对用Value;
   # 13560596974000对应TimeStamp.
后面将分析RowKey与AA-AAA11110UDH的对应关系.


7. 使用HTTP查看文件:
在上面命令中, 也可以有Http查看Hdfs中的文件, 配置在hdfs-site.xml下面配置:
  1. <property>
  2. <name>dfs.datanode.http.address</name>
  3. <value>0.0.0.0:62075</value>
  4. </property>
复制代码

所以访问HDFS的HTTP的URL为:
  1. http://HADOOPCLUS02:62075/browseDirectory.jsp?namenodeInfoPort=62070&dir=/  
复制代码
MapReduce实现将HDFS中的数据解析并写入到HBase表中 目录 一、准备工作 二、功能实现 1、创建Maven工程并导入依赖 2、编写自定义Mapper类 3、编写自定义Reducer类 4、编写自定义Runner类 5、运行代码并查看结果 在上一篇博客中实现了HBase表之间的数据迁移功能: HBase表之间的数据迁移(使用MapReduce实现) 那么,本文继续结合小案例介绍如何使用MapReduce将HDFS中的数据写入到HBase表中。 功能实现: 一、准备工作 1)启动好Zookeeper、Hadoop、HBase服务; [ 阅读详情

相关推荐

HDFS的快照原理和Hbase基于快照的表修复

前一篇文章《HDFS和Hbase误删数据恢复》主要讲了hdfs的回收站机制和Hbase的删除策略。根据hbase的删除策略进行hbase的数据表恢复。本文主要介绍了hdfs的快照原理和根据快照进行的数据恢复。

大明湖里有蛤蟆 5048

【HBase基础】-- HBase 在 HDFS 上的目录说明

1 说明 HBase 在 HDFS 上的目录共有 3 部分:根目录、表目录和 Region 目录。 2 目录说明 2.1 根目录 xml 配置:<name> hbase.rootdir</name> 默认 “/hbase” (1)/hbase/WALs 被 HLog实例管理的WAL文件。 ## /hbase/WALs/data-hbase.com,60020,1542159360923 对于每个HregionServer,日志目录中都包含一个对应的子目录 ## h.

欢迎来到我的博客,一起探索代码里的世界! 2581

mapreduce实现读取hbase表数据保存到hdfs

mapreduce实现读取hbase表数据保存到hdfs 参考资料 https://hbase.apache.org/book.html#mapreduce.example import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; imp...

自由的云 1744

HBase存储在HDFS上目录结构;HBase表中的数据压缩配置

HBase文件存储 HBase是基于HDFS存储文件的,所有文件与文件架构都在HDFS文件系统上 都在hbase这个目录下 这里以1.2.0为例介绍,目录如下: /hbase/.tmp /hbase/WALs /hbase/archive /hbase/corrupt /hbase/data /hbase/hbase.id /hbase/hbase.version /hbase/oldWALs ...

蚂蚁 2980

HDFS和Hbase误删数据恢复

1.hdfs的回收站机制         客户有时会误删一下数据,是在生产环境下,误删数据会造成非常严重的后果。 2.hbase表删除恢复 如果disable+drop误删了hbase表数据,数据不会放到回收站中,hbase有自己的一套删除策略。 fs.trash.interval=0         以分钟为单位的垃圾回收时间,垃圾站中数据超过此时间,会被删除。如果是0,

大明湖里有蛤蟆 1万+

AD20.多对多工程中将某个原理图导入PCB工程

AD20将多个原理图中的一个或多个导入到PCB文件中

鬼爷杂货铺 1万+

[hbase]Hbase 在HDFS上的目录树结构

自从学习了HDFS之后,再学习HBASE之后,我了解到HBASE是架设在HDFS上的,数据存储在HDFS上,哪HBASE在HDFS上的目录树是怎样的呢? 一.0.94-cdh4.2.1版本 系统级别的一级目录如下,用户自定义的均在这个/hbase 下的一级子目录下 /hbase/-ROOT- /hbase/.META. /hbase/.archive /hbase/.corrupt ...

wyz0516071128的博客 1609

【Halcon-1D测量】measure_pairs 函数功能(用于提取垂直于矩形/环形弧主轴的直边对)

HALCON算子measure_pairs是1D测量模块的基础工具,专用于提取垂直于矩形/环形弧主轴的直边对。该算子通过振幅阈值和灰度过渡规则(如positive/negative)进行边对分组,支持_strongest后缀选择最强边缘避免误配对。输出包含边缘坐标、振幅及内外间距(IntraDistance/InterDistance)。关键限制包括仅适用于直边、Sigma需≤0.5×测量长度,且忽略图像域。相比模糊版本算子,它更适用于边缘清晰的简单场景(如电子元件间距测量)。典型应用需配合gen_meas

weixin_45590420的博客 305

hbase在hdfs上的详细目录结构

hbase目录结构如图:  列出/hbase目录下的所有目录和文件,结构如下: drwxr-xr-x - root supergroup 0 2018-10-27 18:26 /hbase/.tmp drwxr-xr-x - root supergroup 0 2018-10-27 18:26 /hbase/.tmp/data drwxr-xr...

L 7981

【电子通识】TINA-TI怎么使用受控源向导创建受控源

TINA-TI怎么使用受控源向导创建受控源

一点硬件 358

Windows 上 openclaw onboard --install-daemon 命令的安装位置和启动配置

摘要:Windows系统中,执行openclaw-cnonboard--install-daemon命令会创建计划任务OpenClawGateway,该任务在用户登录时自动运行位于%USERPROFILE%.openclaw\gateway.cmd的脚本文件来启动服务。管理方法包括通过任务计划程序或命令行(schtasks)查看/启停任务,使用openclaw gateway命令操作服务,或通过删除计划任务和脚本文件完全卸载服务。该机制确保OpenClawGateway服务随系统登录自动启动。(149字)

大坡3D软件开发 1375

hbase hdfs外部表_如何查看HBase表在HDFS中的文件结构

本帖最后由 pig2 于 2014-3-13 01:57 编辑为了查看HBASE表在HDFS中的文件结构.在HBASE中建立一张表结构如下:{NAME => 'USER_TEST_TABLE',MEMSTORE_FLUSHSIZE => '67108864',MAX_FILESIZE => '1073741824',FAMILIES => [{NAME => 'inf...

weixin_39517289的博客 542

在 SAP HANA 里为视图创建 Analytic Privilege,真正把同一份数据按角色切开

摘要:本文介绍了SAP HANA中基于业务角色的动态数据权限控制方法。通过Analytic Privilege技术,可以在同一视图上为不同角色设置不同的数据访问范围,实现行级安全控制。核心机制包括:1) 创建带有STRUCTURED PRIVILEGE CHECK的视图;2) 建立授权对象和用户映射表;3) 开发条件提供过程动态生成过滤条件;4) 创建结构化权限对象绑定条件提供器。这种设计使权限规则与业务数据解耦,便于维护变更,适合销售区域、财务数据等多角色访问控制场景。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 2392

hbase 默认目录_查看HBase表在HDFS中的文件结构

在HBASE中建立一张表结构如下:{NAME=>'USER_TEST_TABLE',MEMSTORE_FLUSHSIZE=>'67108864',MAX_FILESIZE=>'1073741824',FAMILIES=>[{NAME=>'info',BLOOMFILTER=>'NONE',REPLICATION_SCOPE=>'0',C...

weixin_39869378的博客 2899

OSError We couldn‘t connect to https://huggingface.co to load file, couldn‘t find it chatglm3-6b解决方案

本文主要介绍了OSError: We couldn’t connect to https://huggingface.co to load this file, couldn’t find it in the cached files and it looks like THUDM/chatglm3-6b is not the path to a directory containing a file named config.json.解决方案,希望能对学习python的同学们有所帮助。

weixin_43178406的博客 5万+

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

查看HBase表在HDFS中的文件结构(转发)

转自:http://greatwqs.iteye.com/blog/1839232 转载于:https://www.cnblogs.com/yanzibuaa/p/7552011.html

weixin_30617737的博客 104

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

Hbase的使用和分析

基本命令: [root@master shell]# cd ${HBASE_HOME}[root@master hbase]# pwd/opt/hbase [root@master hbase]# ./bin/hbase shell hbase(main):001:0> status1 active master, 0 backup masters, 2 servers, 0 dead...

weixin_30457065的博客 143

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

读取HDFS文件,写入到HBase表当中去

读取hdfs路径/hbase/input/user.txt内容如下 0007 zhangsan 18 0008 lisi 25 0009 wangwu 20 第一步:准备数据文件 准备数据文件,并将数据文件上传到HDFS上面去 hdfs dfs -mkdir -p /hbase/input cd /export/servers/ vim user.txt 0...

汉子一枚 1919

读取HDFS文件中的数据写入到HBase的表中

mapper package com.shengsiyuan.hdfs_to_hbase; import java.io.IOException; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoo...

努力奔跑的蜗牛 2019
上一篇: HBase Flush操作流程以及对读写服务的影响
下一篇: HBase – 并发控制机制解析
LuckyJiang.2021
博客等级 码龄15年 217粉丝 199原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值