Your client application connects to HBase for the first time to perform a write. Which of the following sequences will it traverse to find the region serving the row range of interest? 1. ZooKeeper -> RegionServer -> Region 2. ZooKeeper ->.META. -> RegionServer -> Region 3. Access Mostly Uused Products by 50000+ Subscribers 4. ZooKeeper -> HMaster -> -ROOT- -> .META. -> RegionServer -> Region
The general flow is that a new client contacts the Zookeeper quorum (a separate cluster of Zookeeper nodes) first to find a particular row key. It does so by retrieving the server name (i.e. host name) that hosts the - ROOT- region from Zookeeper. With that information it can query that server to get the server that hosts the . META. table. Both of these two details are cached and only looked up once. Lastly it can query the .META. server and retrieve the server that has the row the client is looking for.
Note: *The .META. table keeps a list of all regions in the system. The .META. table structure is as follows:
Key: Region key of the format ([table],[region start key],[region id]) Values: info:regioninfo (serialized HRegionInfo instance for this region) info:server (server:port of the RegionServer containing this region) info:serverstartcode (start-time of the RegionServer process containing this region)
Question : You have a "Users" table in HBase and you would like to insert a row that consists of a UserID, "jsmith" and an email address, "jane@example.com". The table has a single Column Family named "Meta" and the row key will be the user's ID. The shell command you should use to complete this is: 1. put `Users', `jsmith70', `jane@example.com' 2. put `Users', `UserID:jsmith70', `Email:jane@example.com' 3. Access Mostly Uused Products by 50000+ Subscribers 4. put `Users', `Meta:UserID', `jsmith70', `Meta:Email, `jane@example.com'
Explanation: Put a cell ?value? at specified table/row/column and optionally timestamp coordinates. To put a cell value into table ?t1' at row ?r1' under column ?c1' marked with the time ?ts1', do:
hbase> put ?t1', ?r1', ?c1', ?value?, ts1
The same commands also can be run on a table reference. Suppose you had a reference t to table ?t1', the corresponding command would be:
hbase> t.put ?r1', ?c1', ?value?, ts1
2.Create a table called weblog with one column family named stats: create 'weblog', 'stats'
put 'weblog', 'row1', 'stats:daily', 'test-daily-value'
4.Add a test value to the weekly column in the stats column family for row 1: put 'weblog', 'row1', 'stats:weekly', 'test-weekly-value'
5. Add a test value to the weekly column in the stats column family for row 2: put 'weblog', 'row2', 'stats:weekly', 'test-weekly-value'
In the HBase Shell, you can type put commands to insert a row. put takes 'tableName', 'rowkey','value(optional)', 'columnFamily:columnQualifier', 'value'. Need to include the column family name: Meta for both columns using the : syntax. Note: Columns in Apache HBase are grouped into column families. All column members of a column family have the same prefix. For example, the columns courses:history and courses:math are both members of the courses column family. The colon character (:) delimits the column family from the column qualifier . The column family prefix must be composed of printable characters. The qualifying tail, the column family qualifier, can be made of any arbitrary bytes. Column families must be declared up front at schema definition time whereas columns do not need to be defined at schema time but can be conjured on the fly while the table is up an running.
Question :
You have images stored in HBase, which you need to retrieve from within your application. In which format will your data be returned from an HBase scan? 1. Uninterpreted array of bytes 2. Java string literal 3. Access Mostly Uused Products by 50000+ Subscribers 4. Blob datatype
HBase supports a "bytes-in/bytes-out" interface via Put and Result, so anything that can be converted to an array of bytes can be stored as a value. Input could be strings, numbers, complex objects, or even images as long as they can rendered as bytes.