Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Data backup and recovery Mechanism BDR of HBase

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

I. Snapshot mechanism snapshots

Make a simple test on hbase:

hbase(main):044:0> scan 'student'

ROW COLUMN+CELL

num1 column=shuxing:name, timestamp=1412189531346, value=jaybing

num2 column=shuxing:name, timestamp=1412189623682, value=jaychou

num3 column=shuxing:like, timestamp=1412189669404, value=game

3 row(s) in 0.0260 seconds

Create a snapshot of this table:

hbase(main):045:0> snapshot 'student','snapshot_student'

0 row(s) in 1.2620 seconds

[root@nn ~]# hadoop fs -ls /tmpdir/

Found 9 items

drwxr-xr-x - root supergroup 0 2014-10-02 02:58 /tmpdir/.hbase-snapshot

drwxr-xr-x - root supergroup 0 2014-10-01 21:48 /tmpdir/.tmp

drwxr-xr-x - root supergroup 0 2014-10-01 21:37 /tmpdir/WALs

drwxr-xr-x - root supergroup 0 2014-10-02 02:42 /tmpdir/archive

drwxr-xr-x - root supergroup 0 2014-09-28 00:42 /tmpdir/corrupt

drwxr-xr-x - root supergroup 0 2014-09-26 11:20 /tmpdir/data

-rw-r--r-- 2 root supergroup 42 2014-09-26 11:20 /tmpdir/hbase.id

-rw-r--r-- 2 root supergroup 7 2014-09-26 11:20 /tmpdir/hbase.version

drwxr-xr-x - root supergroup 0 2014-10-02 02:48 /tmpdir/oldWALs

[root@nn ~]# hadoop fs -ls /tmpdir/.hbase-snapshot

Found 2 items

drwxr-xr-x - root supergroup 0 2014-10-02 02:58 /tmpdir/.hbase-snapshot/.tmp

drwxr-xr-x - root supergroup 0 2014-10-02 02:58 /tmpdir/.hbase-snapshot/snapshot_student This should be the snapshot data file;

Delete two rows of student table, simulate data file corruption;

hbase(main):061:0> disable 'student'

0 row(s) in 2.0310 seconds

hbase(main):062:0> is_

is_a? is_disabled is_enabled

hbase(main):062:0> is_enabled 'student'

false

0 row(s) in 0.0800 seconds

hbase(main):063:0> drop

drop drop_all drop_namespace

hbase(main):063:0> drop 'student'

0 row(s) in 0.1940 seconds

hbase(main):064:0> list

TABLE

0 row(s) in 0.0200 seconds

=> []

Restore tables with snapshots:

hbase(main):070:0> restore_snapshot 'snapshot_student'

0 row(s) in 6.4950 seconds

hbase(main):071:0> scan 'student'

ROW COLUMN+CELL

num1 column=shuxing:name, timestamp=1412189531346, value=jaybing

num2 column=shuxing:name, timestamp=1412189623682, value=jaychou

num3 column=shuxing:like, timestamp=1412189669404, value=game

3 row(s) in 0.2190 seconds

Note: Snapshots only save the data of hbase table at the moment of snapshot. As for the incremental data after snapshot, snapshot is not supported;

II. Export table

HBase's table export tool is a built-in feature that makes it easy to import data from hbase into sequencefiles in the hdfs directory. It creates a Map reduce task that calls the cluster through a series of hbase apis to get each row of the specified table and write the data to the specified HDFS directory;

........

III. Copy table

HBase's table copy tool is similar to the export tool, copy table also hbase api creates map reduce task, reads data from the source data, the difference is that the output of the copy is another table of hbase; this table can be in the local cluster or in the remote cluster;

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report