复制部分HBase表用于测试
周海汉/文 2013.4.2 可以将日期08/08/16 20:56:29从hbase log 转换成一个 timestamp, 操作如下: hbase(main):021:0 import java.text.SimpleDateFormat hbase(main):022:0 import java.text.ParsePosition hbase(main):023:0 SimpleDateFormat.new("yy/MM/dd
周海汉/文
2013.4.2
可以将日期’08/08/16 20:56:29′从hbase log 转换成一个 timestamp, 操作如下:
1 2 3 |
|
也可以逆过来操作。
1 2 |
|
1 |
|
hbase(main):001:0> import java.text.SimpleDateFormat
=> Java::JavaText::SimpleDateFormat
hbase(main):002:0> import java.text.ParsePosition
=> Java::JavaText::ParsePosition
hbase(main):004:0> SimpleDateFormat.new(“yyyy/MM/dd HH:mm:ss”).parse(“2013/03/28 00:00:00″, ParsePosition.new(0)).getTime()
=> 1364400000000
hbase(main):005:0> SimpleDateFormat.new(“yyyy/MM/dd HH:mm:ss”).parse(“2013/03/28 00:00:10″, ParsePosition.new(0)).getTime()
=> 1364400010000
[hbase@h46 sh]$ hbase org.apache.hadoop.hbase.mapreduce.CopyTable
Usage: CopyTable [general options] [--starttime=X] [--endtime=Y] [--new.name=NEW] [--peer.adr=ADR]
导出部分数据到另一个表myolc,需先创建该表,也可以指定另一个集群:
1 |
|
[hbase@h46 hbase]$ hbase org.apache.hadoop.hbase.mapreduce.CopyTable –starttime=1364400000000 –endtime=1364400010000 –new.name=myolc online_count
导出实用工具可以将表的内容输出成HDFS的序列化文件,如下调用:
1 |
|
导出2000秒数据
[hbase@h46 hbase]$ hbase org.apache.hadoop.hbase.mapreduce.Export online_count onlinecount 1 1364400000000 1364402000000
[hbase@h46 hbase]$ hadoop fs -ls /user/hbase/onlinecount
Found 3 items
-rw-r–r–?? 3 hbase supergroup????????? 0 2013-04-01 15:56 /user/hbase/onlinecount/_SUCCESS
drwxr-xr-x?? – hbase supergroup????????? 0 2013-04-01 15:55 /user/hbase/onlinecount/_logs
-rw-r–r–?? 3 hbase supergroup??????? 451 2013-04-01 15:56 /user/hbase/onlinecount/part-m-00000
导入实用工具可以加载导出的数据回到HBase,如下调用:
1 |
|
[zhouhh@Hadoop48 ~]$ hadoop fs -put olc onlinecount
[zhouhh@Hadoop48 ~]$ hbase shell
hbase(main):001:0> create ‘online_count’,'info’
?[zhouhh@Hadoop48 ~]$ hbase org.apache.hadoop.hbase.mapreduce.Import online_count onlinecount
相关博文:
- hbase shell中timestamp转为可读格式
- hadoop 中的 ClassNotFoundException
- 从HDFS分析数据到HBase
原文地址:复制部分HBase表用于测试, 感谢原作者分享。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

We users should be able to understand the diversity of some functions when using this platform. We know that the lyrics of some songs are very well written. Sometimes we even listen to it several times and feel that the meaning is very profound. So if we want to understand the meaning of it, we want to copy it directly and use it as copywriting. However, if we want to use it, we still need to You just need to learn how to copy lyrics. I believe that everyone is familiar with these operations, but it is indeed a bit difficult to operate on a mobile phone. So in order to give you a better understanding, today the editor is here to help you. A good explanation of some of the above operating experiences. If you also like it, come and take a look with the editor. Don’t miss it.

What do you think of furmark? 1. Set the "Run Mode" and "Display Mode" in the main interface, and also adjust the "Test Mode" and click the "Start" button. 2. After waiting for a while, you will see the test results, including various parameters of the graphics card. How is furmark qualified? 1. Use a furmark baking machine and check the results for about half an hour. It basically hovers around 85 degrees, with a peak value of 87 degrees and room temperature of 19 degrees. Large chassis, 5 chassis fan ports, two on the front, two on the top, and one on the rear, but only one fan is installed. All accessories are not overclocked. 2. Under normal circumstances, the normal temperature of the graphics card should be between "30-85℃". 3. Even in summer when the ambient temperature is too high, the normal temperature is "50-85℃

The "Inaction Test" of the new fantasy fairy MMORPG "Zhu Xian 2" will be launched on April 23. What kind of new fairy adventure story will happen in Zhu Xian Continent thousands of years after the original work? The Six Realm Immortal World, a full-time immortal academy, a free immortal life, and all kinds of fun in the immortal world are waiting for the immortal friends to explore in person! The "Wuwei Test" pre-download is now open. Fairy friends can go to the official website to download. You cannot log in to the game server before the server is launched. The activation code can be used after the pre-download and installation is completed. "Zhu Xian 2" "Inaction Test" opening hours: April 23 10:00 - May 6 23:59 The new fairy adventure chapter of the orthodox sequel to Zhu Xian "Zhu Xian 2" is based on the "Zhu Xian" novel as a blueprint. Based on the world view of the original work, the game background is set

In the PS copy layer shortcut keys, we can know that if you want to copy a layer when using PS, you can use the shortcut key [Ctrl+J] for quick copying. This introduction to the shortcut keys for copying layers can tell you the specific operation method. The following is the detailed content, so take a look. PS copy layer shortcut key answer: [Ctrl+J] Specific method: 1. Open the image in PS and select the layer that needs to be copied. 2. Press [Ctrl+J] on the keyboard at the same time to complete the copy of the layer. Other copying methods: 1. After opening the image, press and hold the layer and move the [New Layer] icon downwards. 2. After moving to the icon, let go. 3. The layer copy is completed.

"Operation Delta" will launch a large-scale PC test called "Codename: ZERO" today (March 7). Last weekend, this game held an offline flash mob experience event in Shanghai, and 17173 was also fortunate to be invited to participate. This test is only more than four months away from the last time, which makes us curious, what new highlights and surprises will "Operation Delta" bring in such a short period of time? More than four months ago, I experienced "Operation Delta" in an offline tasting session and the first beta version. At that time, the game only opened the "Dangerous Action" mode. However, Operation Delta was already impressive for its time. In the context of major manufacturers flocking to the mobile game market, such an FPS that is comparable to international standards

Maven is an open source project management tool that is commonly used for tasks such as construction, dependency management, and document release of Java projects. When using Maven for project build, sometimes we want to ignore the testing phase when executing commands such as mvnpackage, which will improve the build speed in some cases, especially when a prototype or test environment needs to be built quickly. This article will detail how to ignore the testing phase in Maven, with specific code examples. Why you should ignore testing During project development, it is often

Introduction Continuous integration (CI) and continuous deployment (CD) are key practices in modern software development that help teams deliver high-quality software faster and more reliably. Jenkins is a popular open source CI/CD tool that automates the build, test and deployment process. This article explains how to set up a CI/CD pipeline with Jenkins using PHP. Set up Jenkins Install Jenkins: Download and install Jenkins from the official Jenkins website. Create project: Create a new project from the Jenkins dashboard and name it to match your php project. Configure source control: Configure your PHP project's git repository as Jenkin

Go language function closures play a vital role in unit testing: Capturing values: Closures can access variables in the outer scope, allowing test parameters to be captured and reused in nested functions. Simplify test code: By capturing values, closures simplify test code by eliminating the need to repeatedly set parameters for each loop. Improve readability: Use closures to organize test logic, making test code clearer and easier to read.
