Hbase Tutorial: Creating A Table
Here we will create a table in Hbase
Creating a table
* Start the hbase shell by running
~/hbase/bin/hbase shell
or
hbase shell
Make sure your Hbase Master server is up and running
sudo /usr/lib/hbase/bin/hbase-daemon.sh start master
* Run in the shell
create 'blogposts', 'post', 'image'
Now you have a table called blogposts, with a post, and a image family. These families are “static” like the columns in the RDBMS world.
Add some data to the table
Run the following commands in the shell:
* put 'blogposts', 'post1', 'post:title', 'Hello World'
* put 'blogposts', 'post1', 'post:author', 'The Author'
* put 'blogposts', 'post1', 'post:body', 'This is a blog post'
* put 'blogposts', 'post1', 'image:header', 'image1.jpg'
* put 'blogposts', 'post1', 'image:bodyimage', 'image2.jpg'
Look at the data
Run get ‘blogposts’, ‘post1′ in the shell. This should output something like this.
COLUMN CELL image:bodyimage timestamp=1229953133260, value=image2.jpg image:header timestamp=1229953110419, value=image1.jpg post:author timestamp=1229953071910, value=The Author post:body timestamp=1229953072029, value=This is a blog post post:title timestamp=1229953071791, value=Hello World
No comments
Jump to comment form | comments rss [?] | trackback uri [?]