2016-03-22

tcljsonnet v0.2

首頁:
tcljsonnet


主要更新:
將 Jsonnet code base 版本升到 v0.8.7 版。

2016-03-21

Add https support to HBaseClient-Tcl

HBaseClient-Tcl


可以參考的連結:
https://s3.amazonaws.com/dev.hortonworks.com/HDPDocuments/HDP2/HDP-2.1.2/bk_reference/content/ch05s08.html

首先是產生 keystore:
keytool -genkey -alias hbase -keyalg RSA -keysize 1024 -keystore hbase.jks

再來是 conf/hbase-site.xml,加入下列的設定:

<property>
    <name>hbase.rest.ssl.enabled</name>
    <value>true</value>
</property>

<property>
    <name>hbase.rest.ssl.keystore.store</name>
    <value>/path/to/keystore</value>
</property>

<property>
    <name>hbase.rest.ssl.keystore.password</name>
    <value>keystore password</value>
</property>

<property>
    <name>hbase.rest.ssl.keystore.keypassword</name>
    <value>key password</value>
</property>

第一項就是開啟 ssl 的支援,第二項就是設定  hbase.jks 的位置,例如如果我是在 /home/danilo/Programs/hbase-1.1.3 中,那麼就要填 /home/danilo/Programs/hbase-1.1.3/hbase.jks。

第三項和第四項就是在建立的過程所填寫的密碼。

如果設定成功,就可以使用 https 連線。

使用 https 來連線,所以我就需要改寫  HBaseClient-Tcl 來測試,基本上就是從上一篇 DrillREST  的實作來的:

        if {$ssl_enabled} {
            if {[catch {package require tls}]==0} {
                http::register https 443 [list ::tls::socket -ssl3 0 -ssl2 0 -tls1 1]
            } else {
                error "SSL_ENABLED needs package tls..."
            }
        }

經過測試,看起來可以使用。

2016-03-15

Add https support to DrillREST

Configuring Web Console and REST API Security 中有提到,

Drill 1.2 uses code-level support for transport layer security (TLS) to secure the Web Console and REST API. By default, the Web Console and REST API support the HTTP protocol. You set the following start-up option to TRUE to enable HTTPS support:

drill.exec.http.ssl_enabled

By default this start-up option is set to FALSE.

Drill generates a self-signed certificate that works with SSL for HTTPS access to the Web Console.

如果使用瀏覽器去連 Web Console,是會有警告的。

我不太確定我是不是有完全做對,但是 Apache Drill 的 SSL_ENABLED 在設定打開以後,使用 tls 套件去連線是可以正確連線的。

    constructor {{SERVER http://localhost:8047} {SSL_ENABLED 0}} {
         set server $SERVER
        set ssl_enabled $SSL_ENABLED

        if {$ssl_enabled} {
            if {[catch {package require tls}]==0} {
                http::register https 443 [list ::tls::socket -ssl3 0 -ssl2 0 -tls1 1]
            } else {
                error "SSL_ENABLED needs package tls..."
            }
        }
     }

重點是 package require tls 和下面一行的設定,就完成了。

2016-03-11

DrillREST v0.1

DrillREST:Apache Drill REST Client Library for Tcl


Apache Drill 是一個查詢引擎(可以是分散式系統,或者是跑 embedded mode 單機執行),可以用來查詢有 storage plugin 的資料源(包含 Hadoo/HBase, MongoDB, csv 檔案,JSON 檔案和 Parquet 格式的檔案)。

這是一層 SQL layer,讓你用 SQL-2003 語法(Apache Drill 官網還特別強調自己是標準的 SQL,不是 SQL-like)查詢有支援的資料源。

目前還有一個小缺陷,就是沒有正式支援 Apache Cassandra,但是網路上已經有人可以 patch 以後使用 Apache Drill 查詢 Cassandra,所以我想如果真的有需要,會有人做出來的。

Apache Drill 友善的地方是有 JDBC/ODBC 介面,所以如果要使用 ODBC 來連,可以使用 Tcl 的 TDBC-ODBC 或者是使用其它的 ODBC extension,就可以使用 Apache Drill來查詢各式各樣的資料源(只要 Apache Drill 有支援)。

然後 DrillREST 就如同套件的名稱,使用 Apache Drill REST interface 進行查詢的工作。

如果以查詢資料然後進行分析來講,Apache Drill 是一個強力工具,但是不知道對比 Apache Spark 的戰力如何。

2016-03-09

HBaseClient-Tcl v0.1

HBaseClient-Tcl: HBase REST Client Library for Tcl


要連接 HBase 目前有三個方式(我所知道的):
  • Java API
  • Thrift interface
  • REST interface
這個是閱讀相關的 REST interface 文件以後寫出來的套件,只是確定 Apache HBase REST interface 可以使用,並且我知道該怎麼寫的寫出來記錄而已。

一開始我本來打算用 Thrift + C++ + Tcl sample extension 實作一個 prototype,但是我很快就發現 Thrift 的難度比一開始想像的還要高,嗯…… 然後接下來我就發現 HBase 有提供 REST 介面,所以就實驗看看這個介面能不能使用,至於 Thrift 就跟他說再見吧。

2016-03-04

Tclunqlite v0.2.7

檔案放置網頁


Tclunqlite

About


This is the UnQLite extension for Tcl using the Tcl Extension Architecture (TEA).

UnQLite is a in-process software library which implements a self-contained, serverless, zero-configuration, transactional NoSQL (Key/Value store and Document-store) database engine. This extension provides an easy to use interface for accessing UnQLite database files from Tcl.

Main Change

  1. Fix CURSOR getkey potential issue
  2. Add related test cases
  3. Add Tcl_GetIntFromObj() error check


說明


這是一個小更新的版本,加入更多的 option 檢查。

2016-03-03

tcl.snappy v0.1

tcl.snappy

Snappy is a compression/decompression library. It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression.

This extension is a Tcl extension for snappy library.


我很快樂的寫完以後,才發現在很久很久以前就有人寫好了類似的套件(雖然我是用更霸道的方式,直接放 Snappy library 的 source code 一起編譯)。不過畢竟花了時間,所以還是放上去我的網站跟 Github 了。

2016-03-01

eXist-db SOAP and Web Services for Tcl

使用 Web Services for Tcl 來連線 eXist-db 和斷線。eXist-db 有支援 REST 和 SOAP,這裡嘗試使用 eXist-db 提供的 SOAP介面

package require WS::Client
# package require dict

::WS::Client::GetAndParseWsdl "http://localhost:8080/exist/services/Query?WSDL"

# Connect to eXist-db
dict set args userId "guest"
dict set args password "guest"

set result [::WS::Client::DoCall QueryService connect $args]
set sessionId [dict get $result connectReturn]

# Disconnect
dict set args sessionId $sessionId
set result [::WS::Client::DoCall QueryService disconnect $args]


http://localhost:8080/exist/services/Query?WSDL 就是所有提供的 function。

PS. eXist-db 3.0 RC1 移除了 SOAP 的支援,不過 2.2 的還可以用。