Hbase data backup and recovery mechanism BDR

Source: Internet
Author: User
Tags hadoop fs

I. snapshot mechanism snapshots

Simply create a table on hbase for testing:

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 for this table:
Hbase (main): 045: 0> snapshot 'student ', 'snapshot _ student'
0 row (s) in 1.2620 seconds

[[Email protected] ~] # Hadoop FS-ls/tmpdir/
Found 9 items
Drwxr-XR-X-root supergroup 0 2014-10-02/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/tmpdir/upload upt
Drwxr-XR-X-root supergroup 0/tmpdir/Data
-RW-r -- 2 root supergroup 42/tmpdir/hbase. ID
-RW-r -- 2 root supergroup 7/tmpdir/hbase. Version
Drwxr-XR-X-root supergroup 0 2014-10-02/tmpdir/oldwals
[[Email protected] ~] # Hadoop FS-ls/tmpdir/. hbase-Snapshot
Found 2 items
Drwxr-XR-X-root supergroup 0 2014-10-02/tmpdir/. hbase-Snapshot/. tmp
Drwxr-XR-X-root supergroup 0 2014-10-02/tmpdir/. hbase-Snapshot/snapshot_student this should be the snapshot data file;


Delete two rows of the student table to 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 a table with a snapshot:

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 store the data in the hbase table at the moment when the snapshot is saved. snapshots do not support incremental data after the snapshot;


Ii. Export table export and copy table copytable

Hbase's table export tool is a built-in function that enables data to easily import sequencefiles under the HDFS directory from hbase. It creates a map reduce task, the cluster is called through a series of hbase APIs to obtain each row of data in the specified table and write the data to the specified HDFS directory;


Hbase's table copy tool is similar to the export tool. hbase API also creates a map reduce task to read data from the source. The difference is that the copied output is another hbase table; this table can be in a local cluster or remote cluster;


This article from "Linux _ ant" blog, please be sure to keep this source http://onlyoulinux.blog.51cto.com/7941460/1560656

Hbase data backup and recovery mechanism BDR

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.