Home Database Mysql Tutorial 复制部分HBase表用于测试

复制部分HBase表用于测试

Jun 07, 2016 pm 04:30 PM
hbase copy test part

周海汉/文 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, 操作如下:

                    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 HH:mm:ss").parse("08/08/16 20:56:29", ParsePosition.new(0)).getTime() => 1218920189000
Copy after login

也可以逆过来操作。

                    hbase(main):021:0> import java.util.Date
                    hbase(main):022:0> Date.new(1218920189000).toString() => "Sat Aug 16 20:56:29 UTC 2008"
Copy after login

$ bin/hbase org.apache.hadoop.hbase.mapreduce.CopyTable [--starttime=X] [--endtime=Y] [--new.name=NEW] [--peer.adr=ADR] tablename
Copy after login

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,需先创建该表,也可以指定另一个集群:

--peer.adr=server1,server2,server3:2181:/hbase
Copy after login

[hbase@h46 hbase]$ hbase org.apache.hadoop.hbase.mapreduce.CopyTable –starttime=1364400000000 –endtime=1364400010000 –new.name=myolc online_count

导出实用工具可以将表的内容输出成HDFS的序列化文件,如下调用:

$ bin/hbase org.apache.hadoop.hbase.mapreduce.Export <tablename> <outputdir> [<versions> [<starttime> [<endtime>]]]</endtime></starttime></versions></outputdir></tablename>
Copy after login

导出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,如下调用:

$ bin/hbase org.apache.hadoop.hbase.mapreduce.Import <tablename> <inputdir></inputdir></tablename>
Copy after login

[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

相关博文:

  1. hbase shell中timestamp转为可读格式
  2. hadoop 中的 ClassNotFoundException
  3. 从HDFS分析数据到HBase
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to copy lyrics from QQ Music How to copy lyrics How to copy lyrics from QQ Music How to copy lyrics Mar 12, 2024 pm 08:22 PM

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? - How is furmark considered qualified? What do you think of furmark? - How is furmark considered qualified? Mar 19, 2024 am 09:25 AM

What do you think of furmark? 1. Set the &quot;Run Mode&quot; and &quot;Display Mode&quot; in the main interface, and also adjust the &quot;Test Mode&quot; and click the &quot;Start&quot; 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 &quot;30-85℃&quot;. 3. Even in summer when the ambient temperature is too high, the normal temperature is &quot;50-85℃

Join a new Xianxia adventure! 'Zhu Xian 2' 'Wuwei Test' pre-download is now available Join a new Xianxia adventure! 'Zhu Xian 2' 'Wuwei Test' pre-download is now available Apr 22, 2024 pm 12:50 PM

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

The new king of domestic FPS! 'Operation Delta' Battlefield Exceeds Expectations The new king of domestic FPS! 'Operation Delta' Battlefield Exceeds Expectations Mar 07, 2024 am 09:37 AM

"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

PS copy layer shortcut key PS copy layer shortcut key Feb 23, 2024 pm 02:34 PM

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.

What should I add to the copy shortcut key ctrl? What should I add to the copy shortcut key ctrl? Mar 15, 2024 am 09:57 AM

On Windows, the shortcut key for copying is Ctrl C; on Apple, the shortcut key for copying is Command C; on Linux, the shortcut key for copying is Ctrl Shift C. Knowing these shortcut keys can improve the user's work efficiency and facilitate text or file copy operations.

Learn to use copy-paste shortcuts Learn to use copy-paste shortcuts Jan 13, 2024 pm 12:27 PM

When many users use computers, if they encounter something that needs to be copied and pasted, it is very troublesome to copy with the mouse. So how to use the shortcut keys for copy and paste? Come and take a look at the detailed tutorial ~ Copy and paste shortcuts How to use the key: 1. Copy key: Ctrl+C, select the text or image to be copied, and press the shortcut key. 2. Paste key: Ctrl+V. Just press the shortcut key directly where you want to paste.

How to copy a table in Excel and keep the original format? How to copy a table in Excel and keep the original format? Mar 21, 2024 am 10:26 AM

We often use Excel to process multiple table data. After copying and pasting the set table, the original format returns to the default, and we have to reset it. In fact, there is a way to make the Excel copy table retain the original format. The editor will explain the specific method to you below. 1. Ctrl key dragging and copying operation steps: Use the shortcut key [Ctrl+A] to select all table contents, then move the mouse cursor to the edge of the table until the moving cursor appears. Press and hold the [Ctrl] key, and then drag the table to the desired position to complete the movement. It should be noted that this method only works on a single worksheet and cannot be moved between different worksheets. 2. Steps for selective pasting: Press the [Ctrl+A] shortcut key to select all tables, and press

See all articles