Book Image

HBase Design Patterns

By : Mark Kerzner, Sujee Maniyam
Book Image

HBase Design Patterns

By: Mark Kerzner, Sujee Maniyam

Overview of this book

<p>With the increasing use of NoSQL in general and HBase in particular, knowing how to build practical applications depends on the application of design patterns. These patterns, distilled from extensive practical experience of multiple demanding projects, guarantee the correctness and scalability of the HBase application. They are also generally applicable to most NoSQL databases.</p> <p>Starting with the basics, this book will show you how to install HBase in different node settings. You will then be introduced to key generation and management and the storage of large files in HBase. Moving on, this book will delve into the principles of using time-based data in HBase, and show you some cases on denormalization of data while working with HBase. Finally, you will learn how to translate the familiar SQL design practices into the NoSQL world. With this concise guide, you will get a better idea of typical storage patterns, application design templates, HBase explorer in multiple scenarios with minimum effort, and reading data from multiple region servers.</p>
Table of Contents (15 chapters)
HBase Design Patterns
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Dealing with lost usernames and passwords


Now imagine that a user has lost his/her username, but the user remembers his/her e-mail ID. You just keyed everything on the username, so without it we are lost. You can read all the entries in the database in the attempt of finding this e-mail ID. However, I don't have to convince you how bad this approach is.

So, I challenge you to design your approach. Most of my students, when presented with this challenge in class, started changing the basic user table, preparing it for additional queries. However, the right approach is more radical. Here's some advice from one of the leading NoSQL architects, Patrick McFadin:

"Good question! (We are not alone in our struggle)."

I mention this topic in other venues, too. What do you do if you want to look up by e-mail ID? This might be a good place for an index table, as follows:

create table email_index (
  domain text,
  username text,
  user_id text,
  PRIMARY KEY (domain, username)
);

So, with an address such...