HBase Java Administrative API



Similar documents
Advanced Java Client API

Hadoop Streaming coreservlets.com and Dima May coreservlets.com and Dima May

HBase Key Design coreservlets.com and Dima May coreservlets.com and Dima May

Virtual Machine (VM) For Hadoop Training

Map Reduce Workflows

Apache Pig Joining Data-Sets

Hadoop Distributed File System (HDFS) Overview

HDFS - Java API coreservlets.com and Dima May coreservlets.com and Dima May

HDFS Installation and Shell

MapReduce on YARN Job Execution

The Google Web Toolkit (GWT): The Model-View-Presenter (MVP) Architecture Official MVP Framework

Java with Eclipse: Setup & Getting Started

Hadoop Introduction coreservlets.com and Dima May coreservlets.com and Dima May

The Google Web Toolkit (GWT): Declarative Layout with UiBinder Basics

Official Android Coding Style Conventions

JHU/EP Server Originals of Slides and Source Code for Examples:

Android Programming: 2D Drawing Part 1: Using ondraw

Managed Beans II Advanced Features

Android Programming: Installation, Setup, and Getting Started

Android Programming Basics

Application Security

Session Tracking Customized Java EE Training:

Building Web Services with Apache Axis2

The Google Web Toolkit (GWT): Overview & Getting Started

Web Applications. Originals of Slides and Source Code for Examples:

Web Applications. For live Java training, please see training courses at

For live Java EE training, please see training courses

Object-Oriented Programming in Java: More Capabilities

Localization and Resources

Servlet and JSP Filters

Basic Java Syntax. Slides 2016 Marty Hall,

Handling the Client Request: Form Data

Xiaoming Gao Hui Li Thilina Gunarathne

What servlets and JSP are all about

2011 Marty Hall An Overview of Servlet & JSP Technology Customized Java EE Training:

Media Upload and Sharing Website using HBASE

The Hadoop Eco System Shanghai Data Science Meetup

NoSQL Databases. Big Data 2015

Debugging Ajax Pages: Firebug

& JSP Technology Originals of Slides and Source Code for Examples:

Apache Sqoop. A Data Transfer Tool for Hadoop

HBase. Lecture BigData Analytics. Julian M. Kunkel. University of Hamburg / German Climate Computing Center (DKRZ)

Storage of Structured Data: BigTable and HBase. New Trends In Distributed Systems MSc Software and Systems

Zebra and MapReduce. Table of contents. 1 Overview Hadoop MapReduce APIs Zebra MapReduce APIs Zebra MapReduce Examples...

Comparing SQL and NOSQL databases

Unit Testing with JUnit: A Very Brief Introduction

Word Count Code using MR2 Classes and API

Unleash the Power of HBase Shell

An Overview of Servlet & JSP Technology

An Overview of Java. overview-1

Rapid Application Development. and Application Generation Tools. Walter Knesel

Data storing and data access

Preface. Motivation for this Book

Mobile Applications Developer Track

Intruduction to Groovy & Grails programming languages beyond Java

Controlling Web Application Behavior

The Google Web Toolkit (GWT): JavaScript Native Interface (JSNI)

Creating Java EE Applications and Servlets with IntelliJ IDEA

Automatic generation of fully-executable code from the Domain tier of UML diagrams

COSC 6397 Big Data Analytics. Distributed File Systems (II) Edgar Gabriel Spring HDFS Basics

Introduction to Hbase Gkavresis Giorgos 1470

Enterprise Application Development In Java with AJAX and ORM

Database Applications Recitation 10. Project 3: CMUQFlix CMUQ s Movies Recommendation System

Elastic Map Reduce. Shadi Khalifa Database Systems Laboratory (DSL)

Portals, Portlets & Liferay Platform

Software Development Interactief Centrum voor gerichte Training en Studie Edisonweg 14c, 1821 BN Alkmaar T:

Consuming and Producing Web Services with Web Tools. Christopher M. Judd. President/Consultant Judd Solutions, LLC

HareDB HBase Client Web Version USER MANUAL HAREDB TEAM

Introduction to Big data. Why Big data? Case Studies. Introduction to Hadoop. Understanding Features of Hadoop. Hadoop Architecture.

Processing of massive data: MapReduce. 2. Hadoop. New Trends In Distributed Systems MSc Software and Systems

Syllabus INFO-GB Design and Development of Web and Mobile Applications (Especially for Start Ups)

Apache Spark 11/10/15. Context. Reminder. Context. What is Spark? A GrowingStack

Supporting Multi-tenancy Applications with Java EE

Word count example Abdalrahman Alsaedi

Pro Apache Hadoop. Second Edition. Sameer Wadkar. Madhu Siddalingaiah

Mobile Applications Developer Track

Web and Enterprise Applications Developer Track

Manual. Programmer's Guide for Java API

This example illustrates how to copy contents from one file to another file. This topic is related to the I/O (input/output) of

<Insert Picture Here> Java EE 7. Linda DeMichiel Java EE Platform Lead

Hello World RESTful web service tutorial

Java EE 6 development with Eclipse, Netbeans, IntelliJ and GlassFish. Ludovic Champenois Oracle Corporation

Consuming and Producing Web Services with WST and JST. Christopher M. Judd. President/Consultant Judd Solutions, LLC

Specialized Programme on Web Application Development using Open Source Tools

UBS Training Course Catalog

Module 13 Implementing Java EE Web Services with JAX-WS

MarkLogic Server. MarkLogic Connector for Hadoop Developer s Guide. MarkLogic 8 February, 2015

Object-Oriented Programming in Java

Servlet 3.0. Alexis Moussine-Pouchkine. mercredi 13 avril 2011

Continuous Integration Part 2

Istanbul Şehir University Big Data Camp 14. Hadoop Map Reduce. Aslan Bakirov Kevser Nur Çoğalmış

Transcription:

2012 coreservlets.com and Dima May HBase Java Administrative API Originals of slides and source code for examples: http://www.coreservlets.com/hadoop-tutorial/ Also see the customized Hadoop training courses (onsite or at public venues) http://courses.coreservlets.com/hadoop-training.html Customized Java EE Training: http://courses.coreservlets.com/ Hadoop, Java, JSF 2, PrimeFaces, Servlets, JSP, Ajax, jquery, Spring, Hibernate, RESTful Web Services, Android. Developed and taught by well-known author and developer. At public venues or onsite at your location. 2012 coreservlets.com and Dima May For live customized Hadoop training (including prep for the Cloudera certification exam), please email info@coreservlets.com Taught by recognized Hadoop expert who spoke on Hadoop several times at JavaOne, and who uses Hadoop daily in real-world apps. Available at public venues, or customized versions can be held on-site at your organization. Courses developed and taught by Marty Hall JSF 2.2, PrimeFaces, servlets/jsp, Ajax, jquery, Android development, Java 7 or 8 programming, custom mix of topics Courses Customized available in any state Java or country. EE Training: Maryland/DC http://courses.coreservlets.com/ area companies can also choose afternoon/evening courses. Hadoop, Courses Java, developed JSF 2, PrimeFaces, and taught Servlets, by coreservlets.com JSP, Ajax, jquery, experts Spring, (edited Hibernate, by Marty) RESTful Web Services, Android. Spring, Hibernate/JPA, GWT, Hadoop, HTML5, RESTful Web Services Developed and taught by well-known author and developer. At public venues or onsite at your location. Contact info@coreservlets.com for details

Agenda Create Table Drop Table 4 Java Admin API Just like HTable is for client API HBaseAdmin is for administrative tasks org.apache.hadoop.hbase.client.hbaseadmin Recall that only Table and Family names have to be pre-defined Columns can be added/deleted dynamically HBase scheme roughly equals table definitions and their column families 5

Create Table and Column Families 1. Construct HBaseAdmin instance 2. Create Table s schema Represented by HTableDescriptor class Add column families to table descriptor (HColumnDescriptor) 3. Execute create via HBaseAdmin class 6 1: Construct HBaseAdmin Instance HbaseAdmin s constructor requires an instance of Configuration object Similar to HTable We already know how to do that Configuration conf = HBaseConfiguration.create(); HBaseAdmin admin = new HBaseAdmin(conf); 7

2: Create Table Descriptor org.apache.hadoop.hbase.htabledescriptor Serves as a container for table name and column families Most importantly, add one or more column families org.apache.hadoop.hbase.hcolumndescriptor HColumnDescriptor serves as a container for column family name, compressions settings, number of versions, in-memory setting, and block size HTableDescriptor table = new HTableDescriptor(toBytes("Table")); HColumnDescriptor family = new HColumnDescriptor(toBytes("f")); table.addfamily(family); HColumnDescriptor family1 = new HColumnDescriptor(toBytes("f1")); table.addfamily(family); 8 3: Execute Create via HBaseAdmin HBaseAdmin creates a table via createtable method Synchronous operation admin.createtable(table); 9

CreateTableExample.java public static void main(string[] args) throws IOException { Configuration conf = HBaseConfiguration.create(); HBaseAdmin admin = new HBaseAdmin(conf); String name = "NewTable"; byte [] tablename = tobytes(name); Descriptor for NewTable:new_family HTableDescriptor table = new HTableDescriptor(tableName); HColumnDescriptor family = new HColumnDescriptor(toBytes("new_family")); table.addfamily(family); 10 } System.out.println("Table "+name+" exist: " + admin.tableexists(tablename)) ; System.out.println("Creating "+name+" table..."); admin.createtable(table); System.out.println("Table "+name+" exist: " + admin.tableexists(tablename)) ; Test CreateTableExample.java $ yarn jar $PLAY_AREA/HadoopSamples.jar hbase.createtableexample... Table NewTable exist: false Creating NewTable table... Table NewTable exist: true $ hbase shell hbase> describe 'NewTable' DESCRIPTION {NAME => 'NewTable', FAMILIES => [{NAME => 'new_family', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', COMPRESSION => 'NONE', VERSIONS => '3', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}]} ENABLED true 1 row(s) in 0.0400 seconds 11

Drop Table 1. Construct HBaseAdmin instance 2. Disable table Table must be taken offline in order to perform any schema modifications 3. Delete table 12 DropTableExample.java public static void main(string[] args) throws IOException { Configuration conf = HBaseConfiguration.create(); HBaseAdmin admin = new HBaseAdmin(conf); byte [] tablename = tobytes("newtable"); admin.disabletable(tablename); } admin.deletetable(tablename); Bytes utility class is imported with static keyword: import static org.apache.hadoop.hbase.util.bytes.tobytes; 13

Test DropTableExample.java $ hbase shell hbase> exists 'NewTable' Table NewTable does exist 0 row(s) in 0.1420 seconds hbase> quit $ yarn jar $PLAY_AREA/HadoopSamples.jar hbase.droptableexample... 12/01/16 12:21:44 INFO client.hbaseadmin: Started disable of NewTable 12/01/16 12:21:46 INFO client.hbaseadmin: Disabled NewTable 12/01/16 12:21:46 INFO client.hbaseadmin: Deleted NewTable $ hbase shell hbase> exists 'NewTable' Table NewTable does not exist 0 row(s) in 0.3700 seconds 14 2012 coreservlets.com and Dima May Wrap-Up Customized Java EE Training: http://courses.coreservlets.com/ Hadoop, Java, JSF 2, PrimeFaces, Servlets, JSP, Ajax, jquery, Spring, Hibernate, RESTful Web Services, Android. Developed and taught by well-known author and developer. At public venues or onsite at your location.

Summary We learned how to Create new table Drop an existing table 16 2012 coreservlets.com and Dima May Questions? More info: http://www.coreservlets.com/hadoop-tutorial/ Hadoop programming tutorial http://courses.coreservlets.com/hadoop-training.html Customized Hadoop training courses, at public venues or onsite at your organization http://courses.coreservlets.com/course-materials/java.html General Java programming tutorial http://www.coreservlets.com/java-8-tutorial/ Java 8 tutorial http://www.coreservlets.com/jsf-tutorial/jsf2/ JSF 2.2 tutorial http://www.coreservlets.com/jsf-tutorial/primefaces/ PrimeFaces tutorial http://coreservlets.com/ JSF 2, PrimeFaces, Java 7 or 8, Ajax, jquery, Hadoop, RESTful Web Services, Android, HTML5, Spring, Hibernate, Servlets, JSP, GWT, and other Java EE training Customized Java EE Training: http://courses.coreservlets.com/ Hadoop, Java, JSF 2, PrimeFaces, Servlets, JSP, Ajax, jquery, Spring, Hibernate, RESTful Web Services, Android. Developed and taught by well-known author and developer. At public venues or onsite at your location.