hbase snapshots

42
HBase Snapshots HBase User Group Meetup 10/29/12 Jesse Yates

Upload: calvin

Post on 22-Mar-2016

87 views

Category:

Documents


2 download

DESCRIPTION

HBase User Group Meetup 10/29/12 Jesse Yates. HBase Snapshots. So you wanna …. Prevent data loss Recover to a point in time Backup your data Sandbox copy of data. Problem!. a BIG Problem…. Petabytes of data 100’s of servers At a single point in time Millions of writes per- second. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: HBase Snapshots

HBase Snapshots

HBase User Group Meetup10/29/12

Jesse Yates

Page 2: HBase Snapshots

So you wanna….

• Prevent data loss

• Recover to a point in time

• Backup your data

• Sandbox copy of data

Page 3: HBase Snapshots

Problem!

Page 4: HBase Snapshots

a BIG Problem…

• Petabytes of data

• 100’s of servers

• At a single point in time

• Millions of writes per-second

Page 5: HBase Snapshots

Solution!

Page 6: HBase Snapshots

Solutions!

Page 7: HBase Snapshots

(Obvious) Solutions!

Page 8: HBase Snapshots

Built-in• Export

– MapReduce job against HBase API– Output to single seqeunce file

• Copy Table– MapReduce job against HBase API– Output to another table

Yay• Simple• Heavily tested • Can do point-in-time

Boo• Slow• High impact for running cluster

Page 9: HBase Snapshots

(Less Obvious) Solution!

Page 10: HBase Snapshots

Replication• Export all changes by tailing WAL

YAY• Simple• Gets all edits• Minimal impact on running cluster

Boo• Turn on from beginning• Can’t turn it off and catch up• No built-in point-in-time• Still need ETL process to get multiple copies

Page 11: HBase Snapshots

(Facebook) Solution!1

Mozilla did something similar2

1. issues.apache.org/jira/browse/HBASE-55092. github.com/mozilla-metrics/akela/blob/master/src/main/java/com/mozilla/hadoop/Backup.java

Page 12: HBase Snapshots

Facebook Backup• Copy existing hfiles, hlogs

Yay• Through HDFS

– Doesn’t impact running cluster• Fast

– distcp is 100% faster than M/R through HBase

Boo• Not widely used• Requires Hardlinks• Recovery requires WAL replay• Point-in-time needs filter

Page 13: HBase Snapshots

Backup through the ages

HBaseHDFS

Export

Copy Table

Replication

Facebook

HBASE-50

Page 14: HBase Snapshots

Maybe this is harder than we thought…

Page 15: HBase Snapshots
Page 16: HBase Snapshots

We did some work…

Page 17: HBase Snapshots

Hardlink workarounds

• HBASE-5547– Move deleted hfiles to .archive directory

• HBASE-6610– FileLink: equivalent to Windows link files

Enough to get started….

Page 18: HBase Snapshots

Difficulties

• Coordinating many servers

• Minimizing unavailability

• Minimize time to restore

• Gotta’ be Fast

Page 19: HBase Snapshots

HBASE-50HBASE-6055

Page 20: HBase Snapshots

Snapshots

• Fast- zero-copy of files

• Point-in-time semantics– Part of how its built

• Built-in recovery– Make a table from a snapshot

• SLA enforcement– Guaranteed max unavailability

Coming in HBase-0.96!

Page 21: HBase Snapshots

Snapshots?

Page 22: HBase Snapshots

We’ve got a couple of those…

Page 23: HBase Snapshots

Snapshot Types

• Offline– Table is already disabled

• Globally consistent– Consistent across all servers

• Timestamp consistent– Point-in-time according to each server

Page 24: HBase Snapshots

Offline Snapshots

• Table is already disabled• Requires minimal log replay– Especially if table is cleanly disabled

• State of the table when disabled• Don’t need to worry about changing state

YAY• Fast!• Simple!

Page 25: HBase Snapshots

But I can’t take my table offline!

Page 26: HBase Snapshots

Globally Consistent Snapshots

• All regions block writes until everyone agrees to snapshot– Two-phase commit-ish

• Time-bound to prevent infinite blocking– Unavailability SLA maintained per region

• No Flushing – its fast!

Page 27: HBase Snapshots

What could possibly go wrong?

Page 28: HBase Snapshots

Cross-Server Consistency Problems

• General distributed coordination problems– Block writes while waiting for all regions– Limited by slowest region– servers = P(failure)

• Stronger guarantees than currently in HBase

• Requires WAL replay to restore table

Page 29: HBase Snapshots

I don’t need all that, what else do you have?

Page 30: HBase Snapshots

Timestamp Consistent Snapshots

• All writes up to a TS are in the snapshot

• Leverages existing flush functionality

• Doesn’t block writes

• No WAL replay on recovery

Page 31: HBase Snapshots

Timestamp Consistent?

Page 32: HBase Snapshots

Put/Get/Delete/Mutate/etc.

Timestamp in snapshot?

Snapshot Store Future Store

Yes No

MemStore

Page 33: HBase Snapshots

I’ve got a snapshot,now what?

Page 34: HBase Snapshots

Recovery

• Export snapshot– Send snapshot to another cluster

• Clone snapshot– Create new table from snapshot

• Restore table– Rollback table to specific state

Page 35: HBase Snapshots

Export Snapshot

• Copy a full snapshot to another cluster– All required HFiles/Hlogs– Lots of options

• Fancy dist-cp– Fast!– Minimal impact on running cluster

Page 36: HBase Snapshots

Clone Table

• New table from snapshot

• Create multiple tables from same snapshot

• Exact replica at the point-in-time

• Full Read/Write on new table

Page 37: HBase Snapshots

Restore

• Replace existing table with snapshot

• Snapshots current table, just in case

• Minimal overhead– Handles creating/deleting regions– Fixes META for you

Page 38: HBase Snapshots

Whew, that’s a lot!

Page 39: HBase Snapshots

Even more awesome!

Page 40: HBase Snapshots

Goodies

• Full support in shell

• Distributed Coordination Framework

• ‘Ragged Backup’ added along the way

• Coming in next CDH

• Backport to 0.94?

Page 41: HBase Snapshots

Special thanks!

• Matteo Bertozzi– All the recovery code– Shell support

• Jon Hsieh– Distributed Two-Phase Commit refactor

• All our reviewers…– Stack, Ted Yu, Jon Hsieh, Matteo

Page 42: HBase Snapshots

Thanks!Questions?

Jesse Yates@jesse_yates

[email protected]