A HBase driver for Elixir using HBase Rest and Thrift Interface (v2)
This library leverage both REST and Thrift interface of HBase. The REST interface is used to perform administration task on the database (table creation and deletion). The Thrift interface is used to perform the read and write operation. The Thrift interface use a connection pool to increase the performance. At the moment creation and deletion of table is not supported by the HBase Thrift Interface (v2).
-
Add hbasex to your list of dependencies in
mix.exs
:def deps do [{:hbasex, github: "adrienmo/hbasex", tag: "0.2.0"}] end
-
Ensure hbasex is started before your application:
def application do [applications: [:hbasex]] end
If you want the library to connect automatically to your HBase server at startup add the following in your config/config.exs file
config :hbasex,
host: "localhost",
thrift_port: 9090,
rest_port: 8080,
pool_size: 10,
max_overflow: 0,
max_restart: 3,
max_seconds: 5
# Using REST interface
Hbasex.create_table("abc", ["a"])
Hbasex.delete_table("abc")
# Using thrift interface
Hbasex.put("abc", "123", %{"a" => %{"c1" => 1, "c2" => 2}})
Hbasex.get("abc", "123")
Hbasex.get("abc", "123", columns: %{"a" => ["c1"]})
Hbasex.get("abc", "123", filter_string: Hbasex.Helpers.filter_columns_containing(["c"]))
Hbasex.scan("abc", 100)
Hbasex.scan("abc", 100, prefix: "user123#")
Hbasex.delete("abc", "123")
Hbasex.delete("abc", ["123", "456"])