Giter Site home page Giter Site logo

hbaseclient-tcl's Introduction

HBaseClient

There are various ways to access and interact with Apache HBase. The Java API provides the most functionality.

If users want to use HBase without Java, there are two main approaches for doing that: One is the Thrift interface, the other way to access HBase is using the REST interface.

This extension is a HBase REST Client Library for Tcl. The library consists of a single Tcl Module file.

HBaseClient is using Tcl built-in package http to send request to Apache HBase REST server and get response.

I only test this extension on Apache HBase standalone mode (Apache HBase 1.1.5 and Zookeeper 3.4.8, no security settings).

User needs to start Aapache HBase REST Server daemon.

This extension needs Tcl 8.6, tdom and tcllib base64 package.

Interface

The library has 1 TclOO class, HBaseClient.

Example

A simple example

Get HBase version:

package require HBaseClient
set myhbase [HBaseClient new http://localhost:8080]

$myhbase version

List current tables, now the list is empty:

$myhbase listTable

Then create a table:

$myhbase createTable "test" "cf"

List current tables:

$myhbase listTable

Put some values to test:

$myhbase putValue "test" "row1" "cf" "a" "value1"
$myhbase putValue "test" "row2" "cf" "b" "value2"
$myhbase putValue "test" "row3" "cf" "c" "value3"

Do a stateless scan for our table:

$myhbase scanRow "test"

Get the values:

$myhbase getValue "test" "row1"
$myhbase getValue "test" "row2"
$myhbase getValue "test" "row3"

Or more detail parameters:

$myhbase getValue "test" "row1" "cf" "a"

Try to delete a value:

$myhbase deleteValue "test" "row1" "cf" "a"

Or you can try to delete more values (delete an entire row):

$myhbase deleteValue "test" "row1"

OK, now query again:

$myhbase getValue "test" "row1"

User should get "Not found" response. In the last step, drop the table:

$myhbase deleteTable "test"

HTTPS support

If user enables HTTPS support, below is an example:

package require HBaseClient
set myhbase [HBaseClient new https://localhost:8080 1]

Please notice, I use TLS extension to add https support. So https support needs TLS extension.

hbaseclient-tcl's People

Contributors

ray2501 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.