﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-ivaneeo's blog-随笔分类-bi(商务智能）</title><link>http://www.blogjava.net/ivanwan/category/21710.html</link><description>自由的力量，自由的生活。</description><language>zh-cn</language><lastBuildDate>Tue, 06 Nov 2012 20:29:16 GMT</lastBuildDate><pubDate>Tue, 06 Nov 2012 20:29:16 GMT</pubDate><ttl>60</ttl><item><title>mysql超时设置的问题</title><link>http://www.blogjava.net/ivanwan/archive/2012/11/06/390893.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Tue, 06 Nov 2012 08:29:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2012/11/06/390893.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/390893.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2012/11/06/390893.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/390893.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/390893.html</trackback:ping><description><![CDATA[<br /> <div id="xunlei_com_thunder_helper_plugin_d462f475-c18e-46be-bd10-327458d045bd"></div><p><span>com.mysql.jdbc.CommunicationsException: The last packet 
successfully received from the server was58129 seconds ago.The last 
packet sent successfully to the server was 58129 seconds ago, which is 
longer than the server configured value of 'wait_timeout'. You should 
consider either expiring and/or testing connection validity before use 
in your application, increasing the server configured values for client 
timeouts, or using the Connector/J connection property 
'autoReconnect=true' to avoid this problem.</span></p>
<p>&nbsp;</p>
<p><span>查了一下，原来是mysql超时设置的问题<br /><span>如果连接闲置8小时 (8小时内没有进行数据库操作), mysql就会自动断开连接, 要重启tomcat. <br /></span></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p style="margin: 0cm 0cm 0pt;"><span>解决办法：</span> </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span>&nbsp;&nbsp;&nbsp; 一种. 如果不用hibernate的话, 则在　connection url中加参数: </span><span>autoReconnect=true</span></p>
<p><span>jdbc.url=jdbc:mysql://ipaddress:3306/database?autoReconnect=true&amp;amp;autoReconnectForPools=true<br /></span></p>
<p>&nbsp;</p>
<p><span><br />&nbsp;&nbsp;&nbsp; 二种。用hibernate的话, 加如下属性: <br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="connection.autoReconnect"&gt;true&lt;/property&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="connection.autoReconnectForPools"&gt;true&lt;/property&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="connection.is-connection-validation-required"&gt;true&lt;/property&gt;</p>
<p>&nbsp;</p>
<p><br />&nbsp;&nbsp;&nbsp; 三。要是还用c3p0连接池: <br /><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="hibernate.c3p0.acquire_increment"&gt;1&lt;/property&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="hibernate.c3p0.idle_test_period"&gt;0&lt;/property&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="hibernate.c3p0.timeout"&gt;0&lt;/property&gt;<br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="<span>hibernate.</span>c3p0.validate"&gt;true&lt;/property&gt;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>　四。最不好的解决方案</p>
<p>&nbsp;</p>
<p>使用Connector/J连接MySQL数据库，程序运行较长时间后就会报以下错误：</p>
<p>Communications link failure，The last packet successfully received 
from the server was *** millisecond ago.The last packet successfully 
sent to the server was ***&nbsp; millisecond ago。</p>
<p>其中错误还会提示你修改wait_timeout或是使用Connector/J的autoReconnect属性避免该错误。</p>
<p>后来查了一些资料，才发现遇到这个问题的人还真不少，大部分都是使用连接池方式时才会出现这个问题，短连接应该很难出现这个问题。这个问题的原因：</p>
<p>MySQL服务器默认的&#8220;wait_timeout&#8221;是28800秒即8小时，意味着如果一个连接的空闲时间超过8个小时，MySQL将自动断开该连接，而连接池却认为该连接还是有效的(因为并未校验连接的有效性)，当应用申请使用该连接时，就会导致上面的报错。</p>
<p>1.按照错误的提示，可以在JDBC 
URL中使用autoReconnect属性，实际测试时使用了autoReconnect=true&amp; 
failOverReadOnly=false，不过并未起作用，使用的是5.1版本，可能真像网上所说的只对4之前的版本有效。</p>
<p>2.没办法，只能修改MySQL的参数了，wait_timeout最大为31536000即1年，在my.cnf中加入：</p>
<p>[mysqld] </p>
<p>wait_timeout=31536000 </p>
<p>interactive_timeout=31536000</p>
重启生效，需要同时修改这两个参数<img src ="http://www.blogjava.net/ivanwan/aggbug/390893.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2012-11-06 16:29 <a href="http://www.blogjava.net/ivanwan/archive/2012/11/06/390893.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Hive与HBase的整合</title><link>http://www.blogjava.net/ivanwan/archive/2011/01/10/342685.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Mon, 10 Jan 2011 07:22:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2011/01/10/342685.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/342685.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2011/01/10/342685.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/342685.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/342685.html</trackback:ping><description><![CDATA[<meta http-equiv="content-type" content="text/html; charset=utf-8" /><span  style="color: #404040; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; line-height: 17px; ">
<div class="contenttext" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: hidden; overflow-y: hidden; font-size: 11.5px; ">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">开场白：</strong><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
Hive与HBase的整合功能的实现是利用两者本身对外的API接口互相进行通信，相互通信主要是依靠hive_hbase-handler.jar工具类 (<a href="http://wiki.apache.org/hadoop/Hive/StorageHandlers" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; ">Hive Storage Handlers</a>)， 大致意思如图所示：<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
<img alt="hive-hbase" height="327" src="http://niaklq.bay.livefilestore.com/y1p0k32w2fi4k43d0uKbLdkCsYMad9JJA444Ss9lLAu3ABPv21dAEhooK_3IY_-XLpusyVIH7JyOPY76-ORy8IX2fhMZ2YYi8qA/hive-hbase-arch.jpg?psid=1" width="600" style="margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">口水：</strong><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;对 hive_hbase-handler.jar 这个东东还有点兴趣，有空来磋磨一下。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">一、2个注意事项：</strong><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
1、需要的软件有 Hadoop、Hive、Hbase、Zookeeper，Hive与HBase的整合对Hive的版本有要求，所以不要下载.0.6.0以前的老版本，Hive.0.6.0的版本才支持与HBase对接，因此在Hive的lib目录下可以看见多了hive_hbase-handler.jar这个jar包，他是Hive扩展存储的Handler ，HBase 建议使用 0.20.6的版本，这次我没有启动HDFS的集群环境，本次所有测试环境都在一台机器上。<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;&nbsp; &nbsp;&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
2、运行Hive时，也许会出现如下错误，表示你的JVM分配的空间不够，<strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">错误信息</strong>如下：<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
Invalid maximum heap size: -Xmx4096m<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
The specified size exceeds the maximum representable size.<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
Could not create the Java virtual machine.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">解决方法：<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
/work/hive/bin/ext# vim util/execHiveCmd.sh 文件中第33行<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
修改，<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
HADOOP_HEAPSIZE=4096<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
为<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
HADOOP_HEAPSIZE=256</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">另外，在 /etc/profile/ 加入 export $HIVE_HOME=/work/hive</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">二、启动运行环境</strong><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
1启动Hive<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
hive &#8211;auxpath /work/hive/lib/hive_hbase-handler.jar,/work/hive/lib/hbase-0.20.3.jar,/work/hive/lib/zookeeper-3.2.2.jar -hiveconf hbase.master=127.0.0.1:60000<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
加载 Hive需要的工具类，并且指向HBase的master服务器地址，我的HBase master服务器和Hive运行在同一台机器，所以我指向本地。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">2启动HBase<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
/work/hbase/bin/hbase master start</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">3启动Zookeeper<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
/work/zookeeper/bin/zkServer.sh start</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">三、执行</strong><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
在Hive中创建一张表，相互关联的表<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
CREATE TABLE hbase_table_1(key int, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:val") TBLPROPERTIES ("hbase.table.name" = "xyz");</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">在运行一个在Hive中建表语句，并且将数据导入<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
建表<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;&nbsp; &nbsp;CREATE TABLE pokes (foo INT, bar STRING);<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
数据导入<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;&nbsp; &nbsp;LOAD DATA LOCAL INPATH '/work/hive/examples/files/kv1.txt' OVERWRITE INTO TABLE pokes;</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">在Hive与HBase关联的表中 插入一条数据<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;&nbsp; &nbsp;INSERT OVERWRITE TABLE hbase_table_1 SELECT * FROM pokes WHERE foo=98;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
运行成功后，如图所示：<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
<a href="http://public.bay.livefilestore.com/y1pHJQIdJi1VIB52Kd18sasasgrlxEqlEsLafp8dJKfg8akMb7yG93qW-UFwdaH5IyLMYjWJ1lR9MWi9n8hgSlv9w/hive-hbase.jpg?psid=1" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; "><img alt="hive" height="151" src="http://public.bay.livefilestore.com/y1pHJQIdJi1VIB52Kd18sasaov_unmVqblN70oRSc7krIEaPHE_jIl-26X1nAlGmJOH3CLZs539iAcFsFYp_PblnA/hive-hbase.jpg?psid=1" width="600" style="margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></a></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">插入数据时采用了MapReduce的策略算法，并且同时向HBase写入，如图所示：<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
<img alt="Map-Reduce Job for INSERT" height="301" src="http://niaklq.bay.livefilestore.com/y1pCkjCBrClVasd1Fd51Z-aU0Sj4QeS5ApvZQZR7M3DtldD_72l1IX9Sp09K8afzT_CJqNaXnxJ3ZeWMqS1QapVprHuifTq6n3j/Map-Reduce-INSERT.jpg?psid=1" width="600" style="margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">在HBase shell中运行 scan 'xyz' 和describe "xyz" 命令，查看表结构，运行结果如图所示：<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
<a href="http://public.bay.livefilestore.com/y1phY8sRzb_Sijtj5V2onTbwmx-J1zy8irYqUec7tmoZmt7LXmo3FMWphWXAyEKVvAZPVSDO8yBnwK671HkJ3sSxA/hive-hbase-1.jpg?psid=1" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; "><img alt="hive" height="162" src="http://public.bay.livefilestore.com/y1p8KUXo_4g2PiFzfULzn3yfC5VD9n8g_QoP_Hn8pXr6obRzA6vEPa1Vk66bwx4WXk8W9Vsd7WMXsf7V8wlqtiHlQ/hive-hbase-1.jpg?psid=1" width="600" style="margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></a></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">xyz是通过Hive在Hbase中创建的表，刚刚在Hive的建表语句中指定了映射的属性&nbsp;<strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">"hbase.columns.mapping" = ":key,cf1:val"&nbsp;</strong>&nbsp;和 在HBase中建表的名称&nbsp;<strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">"hbase.table.name" = "xyz"</strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">在hbase在运行put命令，插入一条记录<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;&nbsp; &nbsp;<strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">put 'xyz','10001','cf1:val','www.javabloger.com'</strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">在hive上运行查询语句，看看刚刚在hbase中插入的数据有没有同步过来，<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;&nbsp; &nbsp;select * from hbase_table_1 WHERE key=10001;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
如图所示：<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
<a href="http://public.bay.livefilestore.com/y1pJjI-f9ZM1rcz57xHfBU8ij5Z5RL5KeXTmsAKjuPf4AJPnkkMh8uH1Yv_VfaWr2lyKArQ1mpruzn1p8JOHVrAtA/hive-hbase-3.jpg?psid=1" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; "><img alt="hive" height="150" src="http://public.bay.livefilestore.com/y1pJjI-f9ZM1rcz57xHfBU8it2nY-sgJeQPQ5TepAA7Q8do2AUYMECZ28aN0MflhjrK-hkXS2Hw_1FAi6xIk5x7Aw/hive-hbase-3.jpg?psid=1" width="600" style="margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></a></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">最终的效果</strong><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;&nbsp; &nbsp;以上整合过程和操作步骤已经执行完毕，现在<strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Hive中添加记录HBase中有记录添加，同样你在HBase中添加记录Hive中也会添加</strong>， 表示Hive与HBase整合成功，对海量级别的数据我们是不是可以在HBase写入，在Hive中查询 喃？因为<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">HBase 不支持<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">复杂的查询，但是HBase可以作为基于 key 获取一行或多行数据，或者扫描数据区间，以及过滤操作。而</span>复杂的<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">查询可以让</span></span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Hive</span></span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">来完成</span></span>，一个作为存储的入口(HBase)，一个作为查询的入口(Hive)。如下图示。<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;&nbsp;&nbsp;&nbsp;<img alt="hive mapreduce" height="299" src="http://niaklq.bay.livefilestore.com/y1pIvjweuRWQDmuR4EMM2tY25wcDc5NGTcsKpo_9PGZGtSUqquFW2NKqevGhgmVBDIp4Fh_HKg-gyf3EdsKBkVZr3N3TXXa7axS/hive-hbase-4-last.jpg?psid=1" width="600" style="margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;&nbsp; &nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;&nbsp; &nbsp;呵呵，见笑了，以上只是我面片的观点。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">先这样，稍后我将继续更新，感谢你的阅读。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">相关文章：<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;<a href="http://www.javabloger.com/article/apache-hive-2.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; ">Apache Hive入门2&nbsp;</a><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;<a href="http://www.javabloger.com/article/apache-hive-jdbc-mapreduce.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; ">Apache Hive入门1</a></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;<a href="http://www.javabloger.com/article/apache-hbase-hadoop.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; ">HBase入门篇4&nbsp;</a><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;<a href="http://www.javabloger.com/article/hbase-performance-hbase-optimized.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; ">HBase入门篇3&nbsp;</a><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;<a href="http://www.javabloger.com/article/apache-hbase-shell-and-java-api-html.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; ">HBase入门篇2&nbsp;</a><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
&nbsp;<a href="http://www.javabloger.com/article/apache-hbase-shell-and-install-key-value.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; ">HBase入门篇</a></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&#8211;end&#8211;</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p>
</div>
<div align="right" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><font color="#2DA653" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">豆瓣</font><font color="#7BC30A" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">读书</font></strong>&nbsp;&nbsp;向你推荐有关<a target="_blank" href="http://book.douban.com/subject_search?search_text=HBase&amp;cat=1001" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; ">&nbsp;HBase</a>、&nbsp;<a target="_blank" href="http://book.douban.com/subject_search?search_text=Hadoop&amp;cat=1001" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; ">Hadoop</a>、&nbsp;<a target="_blank" href="http://book.douban.com/subject_search?search_text=Hive&amp;cat=1001" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; ">Hive</a>、&nbsp;<a target="_blank" href="http://book.douban.com/subject_search?search_text=MapReduce&amp;cat=1001" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; ">MapReduce</a>、&nbsp;<a target="_blank" href="http://book.douban.com/subject_search?search_text=%E4%BA%91%E8%AE%A1%E7%AE%97&amp;cat=1001" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; ">云计算</a>、&nbsp;<a target="_blank" href="http://book.douban.com/subject_search?search_text=%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1&amp;cat=1001" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; font-weight: bold; text-decoration: none; ">架构设计</a>、 类别的图书。</div>
<div><br />
</div>
</span>
<img src ="http://www.blogjava.net/ivanwan/aggbug/342685.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2011-01-10 15:22 <a href="http://www.blogjava.net/ivanwan/archive/2011/01/10/342685.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Facebook的新实时消息系统：Hbase——每月存储1350+亿条消息</title><link>http://www.blogjava.net/ivanwan/archive/2011/01/10/342682.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Mon, 10 Jan 2011 06:57:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2011/01/10/342682.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/342682.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2011/01/10/342682.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/342682.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/342682.html</trackback:ping><description><![CDATA[<meta http-equiv="content-type" content="text/html; charset=utf-8" /><span  style="color: #555555; font-family: 'Lucida Grande', Verdana, Arial, sans-serif; font-size: 9px; ">
<div class="post-entry" style="font: normal normal normal 1.2em/1.5em 'Lucida Grande', Verdana, Arial, sans-serif; ">
<p style="text-align: justify; ">Facebook的新实时消息系统：Hbase——每月存储1350亿条消息</p>
<p style="text-align: justify; ">你或许已经知道，facebook已经介绍过全新的social inbox产品，集成了email，IM，短信，文本信息，facebook的在线消息。最为重要的是，他们每个月要存储超过1350亿条消息。他们如何存放这些信息呢？facebook的Kannan Muthukkaruppan在<a href="http://www.facebook.com/note.php?note_id=454991608919#" target="_blank" style="color: #557799; text-decoration: none; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #eeeeee; ">《邮件的底层技术：HBase》</a>一文中给了一个十分意外的答案——HBase，打败了MySQL，Cassandra和其他一些技术，成为facebook的选择。</p>
<p style="text-align: justify; ">为什么说是一个意外的答案？facebook创造了Cassandra，并且其就是为邮件类型的应用而打造的，但是他们发现Cassandra的最终一致性模型并不适合他们的全新的实时邮件产品。Facebook同样拥有大量的MySQL架构，但是他们发现性能会随着数据和索引的增加变差。他们同样可以选择自己来开发一个新的存储模型，但是他们最终选择了HBase。</p>
<p style="text-align: justify; ">HBase是一个可扩展的、并且支持海量数据下的高并发记录级别更新操作的表存储产品——为邮件系统量身定做。HBase同样支持基于BigTable模型的key-value存储。这样能够很好的支持按key来查找记录以及按范围来搜寻或者过滤，这也是邮件系统的特性之一。然而，复杂一点的查询却并不被支持。查询是通过一个叫Hive的工具来进行分析的，这是facebook创造的用以处理他们几个P的数据仓库的，Hive是基于Hadoop文件系统HDFS，这也是HBase所采用的文件系统。</p>
<p style="text-align: justify; ">Facebook检视了他们的应用场景，指出他们为什么要选择HBase。他们所需要的系统应该能处理以下两种数据：</p>
<ol>
    <li>一个较小的临时数据集，是经常变化的。</li>
    <li>一个不断增加的数据集，是很少被访问的。</li>
</ol>
<p style="text-align: justify; ">有点意思哈。你阅读了收件箱里的邮件，以后就很少再去看它一眼了。这两种截然不同的数据使用方式，你可能会用两个系统来实现。但是显然HBase就能搞定这一切。目前尚不清楚它是如何（在两种数据集上）来实现通用的搜索功能的，尽管它集成了多种搜索引擎。</p>
<p style="text-align: justify; ">他们系统的一些关键特性：</p>
<p style="text-align: justify; ">&#183;HBase：</p>
<p style="text-align: justify; ">&#183;拥有一个比Cassandra更简答的一致性模型。</p>
<p style="text-align: justify; ">&#183;非常好的可伸缩性和性能。</p>
<p style="text-align: justify; ">&#183;大多数特性对他们的需求来说是足足有余的：自动负载平衡和故障转移，支持压缩，单机多个切片（multiple shards）。</p>
<p style="text-align: justify; ">&#183;HDFS是HBase使用的文件系统，支持冗余复制，端到端的校验以及自动恢复平衡。</p>
<p style="text-align: justify; ">&#183;facebook的运维团队在使用HDFS方面有丰富的经验，他们是Hadoop的大客户，Hadoop就是使用HDFS作为分布式文件系统的。</p>
<p style="text-align: justify; ">&#183;Haystack用来做为存储附件用的。</p>
<p style="text-align: justify; ">&#183;重头开始写了一个自定义的应用server，以便处理大量来自不同源的消息。</p>
<p style="text-align: justify; ">&#183;在ZooKeeper的顶层实现了一个&#8220;用户发现服务&#8221;。</p>
<p style="text-align: justify; ">&#183;使用了一系列的基础服务：email帐户验证，好友关系链，隐私控制，消息传送控制（消息是通过chat系统发送还是通过短信系统发送）。</p>
<p style="text-align: justify; ">&#183;保持了他们一贯的作风，小团队做出令人惊讶的事情：15个工程师花了1年的时间发布了20个新的基础服务。</p>
<p style="text-align: justify; ">&#183;facebook不打算只使用一个数据库平台并在这之上实现标准化应用，他们会针对不同的应用使用不同的平台。</p>
<p style="text-align: justify; ">Facebook在HDFS/Hadoop/Hive上有了丰富的经验，并且成为HBase的大客户，这让我夜不能寐。与一个十分流行的产品合作并成为其产业链的一部分是所有产品的梦想。这正是HBase所得到的。由于HBase涵盖了诸如持久性，实时性，分布式，线性扩展，健壮性，海量数据，开源，key-value，列导向（column-oriented）等热点。我们有理由相信它能变得更加流行，特别是基于它被facebook使用的事实。</p>
<p style="text-align: justify; ">（原文作者Todd Hoff，C++代码规范的作者）</p>
</div>
<p class="post-meta" style="text-align: justify; clear: both; margin-top: 1.6em; font-size: 1.1em; color: #999999; ">Posted by kaoshijuan on 2010 年 11 月 23 日 at 上午 9:22 under&nbsp;<a href="http://www.kaoshijuan.net/blog/?cat=1" title="查看 未分类 的全部文章" rel="category" style="color: #557799; text-decoration: none; ">未分类</a>.<br />
<a href="http://www.kaoshijuan.net/blog/?p=21#comments" title="Facebook的新实时消息系统：Hbase——每月存储1350+亿条消息 上的评论" style="color: #557799; text-decoration: none; ">1 Comment</a>.</p>
</span>
<img src ="http://www.blogjava.net/ivanwan/aggbug/342682.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2011-01-10 14:57 <a href="http://www.blogjava.net/ivanwan/archive/2011/01/10/342682.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>informatica重点</title><link>http://www.blogjava.net/ivanwan/archive/2007/04/19/111957.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Thu, 19 Apr 2007 07:43:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2007/04/19/111957.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/111957.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2007/04/19/111957.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/111957.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/111957.html</trackback:ping><description><![CDATA[1.<br>&nbsp;&nbsp;&nbsp; Transformation代表Informatica Server对数据的操作。<br>&nbsp;&nbsp;&nbsp; Transformation分类：Active和Passive<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  输入跟输出的记录数会发生改变<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  不能re-linked到另一个data stream<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  例子：Aggregator, Filter, Joiner, Normalizer, Rank, Update Strategy, Advanced External Procedure, <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ERP Source Qualifier and Source Qualifier, Application Source Qualifier, Router, Sorter &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; Passive transformations<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  输入跟输出的记录数一样<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 可以re-linked到另一个data stream<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 例子：Expression, External Procedure, Lookup, Sequence Generator&nbsp; Stored Procedure, Input, <br>Output, XML Source Qualifier <br>&nbsp;&nbsp;&nbsp; &nbsp; Transformations分类 : connected 和 unconnected,unconnected transformation在其他的组件中被调用并且有返回值。<br><br><img src ="http://www.blogjava.net/ivanwan/aggbug/111957.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2007-04-19 15:43 <a href="http://www.blogjava.net/ivanwan/archive/2007/04/19/111957.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>数据的清洗转换</title><link>http://www.blogjava.net/ivanwan/archive/2007/04/18/111485.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Wed, 18 Apr 2007 01:12:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2007/04/18/111485.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/111485.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2007/04/18/111485.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/111485.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/111485.html</trackback:ping><description><![CDATA[<h5>ETL的简介：<br></h5>
<h5>&nbsp;&nbsp;&nbsp; ETL即数据抽取（Extract）、转换（Transform）、装载（Load）的过程，它是构建数据仓库的重要环节</h5>
1、 数据清洗<br><br>
数据清洗的任务是过滤那些不符合要求的数据，将过滤的结果交给业务主管部门，确认是否过滤掉还是由业务单位修正之后再进行抽取。不符合要求的数据主要是有不完整的数据、错误的数据、重复的数据三大类。
<p>　　(1)不完整的数据：这一类数据主要是一些应该有的信息缺失，如供应商的名称、分公司的名称、客户的区域信息缺失、业务系统中主表与明细表不能
匹配等。对于这一类数据过滤出来，按缺失的内容分别写入不同Excel文件向客户提交，要求在规定的时间内补全。补全后才写入数据仓库。</p>
<p>　　(2)错误的数据：这一类错误产生的原因是业务系统不够健全，在接收输入后没有进行判断直接写入后台数据库造成的，比如数值数据输成全角数字字
符、字符串数据后面有一个回车操作、日期格式不正确、日期越界等。这一类数据也要分类，对于类似于全角字符、数据前后有不可见字符的问题，只能通过写
SQL语句的方式找出来，然后要求客户在业务系统修正之后抽取。日期格式不正确的或者是日期越界的这一类错误会导致ETL运行失败，这一类错误需要去业务
系统数据库用SQL的方式挑出来，交给业务主管部门要求限期修正，修正之后再抽取。</p>
<p>　　(3)重复的数据：对于这一类数据——特别是维表中会出现这种情况——将重复数据记录的所有字段导出来，让客户确认并整理。</p>
<p>　　数据清洗是一个反复的过程，不可能在几天内完成，只有不断的发现问题，解决问题。对于是否过滤，是否修正一般要求客户确认，对于过滤掉的数据，
写入Excel文件或者将过滤数据写入数据表，在ETL开发的初期可以每天向业务单位发送过滤数据的邮件，促使他们尽快地修正错误,同时也可以做为将来验
证数据的依据。数据清洗需要注意的是不要将有用的数据过滤掉，对于每个过滤规则认真进行验证，并要用户确认。</p>
<br>
<p><br></p>
<p>2、 数据转换</p>
<p>数据转换的任务主要进行不一致的数据转换、数据粒度的转换，以及一些商务规则的计算。
</p>
<p>　　(1)不一致数据转换：这个过程是一个整合的过程，将不同业务系统的相同类型的数据统一，比如同一个供应商在结算系统的编码是XX0001,而在CRM中编码是YY0001，这样在抽取过来之后统一转换成一个编码。</p>
<p>　　(2)数据粒度的转换：业务系统一般存储非常明细的数据，而数据仓库中数据是用来分析的，不需要非常明细的数据。一般情况下，会将业务系统数据按照数据仓库粒度进行聚合。</p>
<p>　　(3)商务规则的计算：不同的企业有不同的业务规则、不同的数据指标，这些指标有的时候不是简单的加加减减就能完成，这个时候需要在ETL中将这些数据指标计算好了之后存储在数据仓库中，以供分析使用。</p>
<p><strong>三、ETL日志、警告发送</strong></p>
<p>1、 ETL日志
</p>
<p>　　ETL日志分为三类。一类是执行过程日志，这一部分日志是在ETL执行过程中每执行一步的记录，记录每次运行每一步骤的起始时间，影响了多少行
数据，流水账形式。一类是错误日志，当某个模块出错的时候写错误日志，记录每次出错的时间、出错的模块以及出错的信息等。第三类日志是总体日志，只记录
ETL开始时间、结束时间是否成功信息。如果使用ETL工具,ETL工具会自动产生一些日志，这一类日志也可以作为ETL日志的一部分。记录日志的目的是
随时可以知道ETL运行情况，如果出错了，可以知道哪里出错。</p>
<p>　　2、 警告发送</p>
<p>　　如果ETL出错了，不仅要形成ETL出错日志，而且要向系统管理员发送警告。发送警告的方式多种，一般常用的就是给系统管理员发送邮件，并附上出错的信息，方便管理员排查错误。</p>
<p>　　ETL是BI项目的关键部分，也是一个长期的过程，只有不断的发现问题并解决问题，才能使ETL运行效率更高，为BI项目后期开发提供准确的数据。</p>
<br><img src ="http://www.blogjava.net/ivanwan/aggbug/111485.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2007-04-18 09:12 <a href="http://www.blogjava.net/ivanwan/archive/2007/04/18/111485.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>