欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

hbaseORMsimplehbasev0.6簡(jiǎn)介-創(chuàng)新互聯(lián)

https://github.com/zhang-xzhi/simplehbase/
https://github.com/zhang-xzhi/simplehbase/wiki

simplehbase是java和hbase之間的輕量級(jí)中間件。
主要包含以下功能。
*  數(shù)據(jù)類(lèi)型映射:java類(lèi)型和hbase的bytes之間的數(shù)據(jù)轉(zhuǎn)換。
*  簡(jiǎn)單操作封裝:封裝了hbase的put,get,scan等操作為簡(jiǎn)單的java操作方式。
*  hbase query封裝:封裝了hbase的filter,可以使用sql-like的方式操作hbase。
*  動(dòng)態(tài)query封裝:類(lèi)似于myibatis,可以使用xml配置動(dòng)態(tài)語(yǔ)句查詢(xún)hbase。
*  insert,update支持: 建立在hbase的checkAndPut之上。
*  hbase多版本支持:提供接口可以對(duì)hbase多版本數(shù)據(jù)進(jìn)行查詢(xún),映射。
*  hbase原生接口支持。

## simplehbase示例(SampleMain.java)

### 使用simplehbaseclient操作hbase

    SimpleHbaseClient simpleHbaseClient = getSimpleHbaseClient();

    //insert one record.
    Person one = new Person();
    one.setId(1);
    one.setName("allen");
    one.setAge(30);
    one.setGender(Gender.MALE);
    simpleHbaseClient.putObject(new PersonRowKey(1), one);

    //insert another record.
    Person two = new Person();
    two.setId(2);
    two.setName("dan");
    two.setAge(31);
    two.setGender(Gender.FEMALE);
    simpleHbaseClient.putObject(new PersonRowKey(2), two);

    //search by row key.
    Person result = simpleHbaseClient.findObject(new PersonRowKey(1),
        Person.class);
    log.info(result);

    //search by range.
    List<Person> resultList = simpleHbaseClient.findObjectList(
        new PersonRowKey(1), new PersonRowKey(3), Person.class);
    log.info(resultList);

    //HQL query.
    Map<String, Object> para = new HashMap<String, Object>();
    para.put("id", 1);
    resultList = simpleHbaseClient.findObjectList(new PersonRowKey(1),
        new PersonRowKey(3), Person.class, "queryById", para);
    log.info(resultList);

    //dynamic HQL.
    para.put("name", "allen");
    para.put("age", 0);
    resultList = simpleHbaseClient.findObjectList(new PersonRowKey(1),
        new PersonRowKey(3), Person.class, "queryByNameAndAge", para);
    log.info(resultList);

    //batch delete.
    simpleHbaseClient.deleteObjectList(new PersonRowKey(0),
        new PersonRowKey(100), Person.class);

### 初始化simplehbase

    HBaseDataSource hbaseDataSource = new HBaseDataSource();

    List<Resource> hbaseConfigResources = new ArrayList<Resource>();
    //If run on hbase cluster, modify the following config files.
    //If run on hbase stand alone mode, comment out the following config files.
    hbaseConfigResources.add(new CachedFileSystemResource(
        "sample\\hbase_site"));
    hbaseConfigResources
        .add(new CachedFileSystemResource("sample\\zk_conf"));
    hbaseDataSource.setHbaseConfigResources(hbaseConfigResources);

    hbaseDataSource.init();

    HBaseTableConfig hbaseTableConfig = new HBaseTableConfig();
    //simplehbase config file.
    hbaseTableConfig.setConfigResource(new CachedFileSystemResource(
        "sample\\myRecord.xml"));

    hbaseTableConfig.init();

    SimpleHbaseClient tClient = new SimpleHbaseClientImpl();
    tClient.setHbaseDataSource(hbaseDataSource);
    tClient.setHbaseTableConfig(hbaseTableConfig);

    return tClient;

### simplehbase配置xml
包含htable的配置和2個(gè)動(dòng)態(tài)查詢(xún)的配置
<SimpleHbase>

  <HBaseTableSchema tableName="MyRecordV05" defaultFamily="MyRecordFamily">
    <HBaseColumnSchema qualifier="id" typeName="int" />
    <HBaseColumnSchema qualifier="name" typeName="string" />
    <HBaseColumnSchema qualifier="date" typeName="date" />
    <HBaseColumnSchema qualifier="gender" typeName="allen.sample.Gender" />
    <HBaseColumnSchema qualifier="age" typeName="int" />
  </HBaseTableSchema>

  <statements>

    <statement id="queryByNameAndAge">
      select where id greaterequal #id#
      <isPropertyAvailable prepend="and" property="name">
        name equal #name#
      </isPropertyAvailable>
      <isPropertyAvailable prepend="and" property="age">
        age greater #age#
      </isPropertyAvailable>
    </statement>

    <statement id="queryById">
      select where id equal #id#
    </statement>

  </statements>
</SimpleHbase>

### 定義DO對(duì)象
  @HBaseTable(defaultFamily = "MyRecordFamily")
  public class Person {
    @HBaseColumn(qualifier = "id")
    private int   id;
    @HBaseColumn(qualifier = "name")
    private String name;
    @HBaseColumn(qualifier = "date")
    private Date  date;
    @HBaseColumn(qualifier = "gender")
    private Gender gender;
    @HBaseColumn(qualifier = "age")
    private int   age;
  }

### 定義該DO對(duì)象對(duì)應(yīng)的rowkey
  public class PersonRowKey implements RowKey {

    private int row;

    public PersonRowKey(int row) {
      this.row = row;
    }

    @Override
    public byte[] toBytes() {
      return Bytes.toBytes(row);
    }
  }

simphbase simplehbaseviewer使用說(shuō)明

### simplehbase/simplehbaseviewer版本
0.5.1 / 0.6 / 0.7

### jdk
jdk/jre 1.6

### maven
maven2

### 代碼下載
最新simplehbase代碼下載。
https://github.com/zhang-xzhi/simplehbase
右下角的download zip。

帶版本的simplehbase版本下載。
https://github.com/zhang-xzhi/simplehbase/releases

最新simplehbaseviewer代碼下載。
https://github.com/zhang-xzhi/simplehbaseviewer
右下角的download zip。

帶版本的simplehbaseviewer版本下載。
https://github.com/zhang-xzhi/simplehbaseviewer/releases

### Simplehbase本地驗(yàn)證
代碼下載后,mvn eclipse:eclipse后導(dǎo)入eclipse。
運(yùn)行simplehbase的test。(Junit)

目前simplehbase默認(rèn)的測(cè)試環(huán)境為

  hbase.zookeeper.quorum=hbdev-1.alipay.net,hbdev-2.alipay.net,hbdev-3.alipay.net,hbdev-4.alipay.net,hbdev-5.alipay.net
  hbase.zookeeper.property.clientPort=2181
  zookeeper.znode.parent=/hbase-94

* 1 若無(wú)法連接,修改test/zk_conf文件(集成測(cè)試使用,修改sample/zk_conf文件(樣例程序使用)。
* 2 建測(cè)試表。運(yùn)行CreateTestTable, 新建MyRecordV05表。
* 3 建表成功后,重新運(yùn)行test,后續(xù)運(yùn)行,不需要重新建立測(cè)試表。
* 4 新增htable的配置,請(qǐng)參考既有表的配置。

### Simplehbaseviewer本地驗(yàn)證
安裝simplehbase到本地倉(cāng)庫(kù)。
在simplehbase項(xiàng)目中,mvn install。

simplehbaseviewer代碼下載后,mvn eclipse:eclipse后導(dǎo)入eclipse。

運(yùn)行Main。

訪(fǎng)問(wèn)http://localhost:4040/hbaseviewer/
看simplehbaseview是否啟動(dòng)正常。

目前simplehbaseviewer默認(rèn)的測(cè)試環(huán)境為

  hbase.zookeeper.quorum=hbdev-1.alipay.net,hbdev-2.alipay.net,hbdev-3.alipay.net,hbdev-4.alipay.net,hbdev-5.alipay.net
  hbase.zookeeper.property.clientPort=2181
  zookeeper.znode.parent=/hbase-94

* 1 若無(wú)法連接,修改config/zk_conf文件。
* 2 建測(cè)試表。運(yùn)行CreateTestTable, 新建MyRecordV05表。
* 3 建表成功后,重新運(yùn)行Main。

### Simplehbase jar包依賴(lài)
pom依賴(lài),請(qǐng)參考simplehbase的pom文件。

其中,hadoop和hbase可以修改為目前集團(tuán)hbase使用的版本。

Simplehbase開(kāi)發(fā)測(cè)試過(guò)程中使用的hbase版本為0.94.0。

理論上,hbase0.92也可以使用,但是未經(jīng)測(cè)試,可以跑test進(jìn)行測(cè)試。

### Simplehbaseclient配置
SimpleHbaseClient為simplehbase的核心接口。

Java方式配置可以參考simplehbase的SampleMain。

Spring方式配置可以參考simplehbaseviewer的
\hbaseviewer\WEB-INF\spring\simplehbase.xml

如何配置可以參考或直接查看代碼:
https://github.com/zhang-xzhi/si ... -%E9%85%8D%E7%BD%AE

### doc
* https://github.com/zhang-xzhi/simplehbase/wiki
* https://github.com/zhang-xzhi/simplehbaseviewer/wiki
* simplehbase下載后simplehbase\doc

創(chuàng)新互聯(lián)成立十多年來(lái),這條路我們正越走越好,積累了技術(shù)與客戶(hù)資源,形成了良好的口碑。為客戶(hù)提供網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計(jì)、網(wǎng)站策劃、網(wǎng)頁(yè)設(shè)計(jì)、域名注冊(cè)、網(wǎng)絡(luò)營(yíng)銷(xiāo)、VI設(shè)計(jì)、網(wǎng)站改版、漏洞修補(bǔ)等服務(wù)。網(wǎng)站是否美觀、功能強(qiáng)大、用戶(hù)體驗(yàn)好、性?xún)r(jià)比高、打開(kāi)快等等,這些對(duì)于網(wǎng)站建設(shè)都非常重要,創(chuàng)新互聯(lián)通過(guò)對(duì)建站技術(shù)性的掌握、對(duì)創(chuàng)意設(shè)計(jì)的研究為客戶(hù)提供一站式互聯(lián)網(wǎng)解決方案,攜手廣大客戶(hù),共同發(fā)展進(jìn)步。

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線(xiàn),公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿(mǎn)足用戶(hù)豐富、多元化的應(yīng)用場(chǎng)景需求。

當(dāng)前標(biāo)題:hbaseORMsimplehbasev0.6簡(jiǎn)介-創(chuàng)新互聯(lián)
網(wǎng)站鏈接:http://www.chinadenli.net/article26/dpdhjg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶(hù)體驗(yàn)App開(kāi)發(fā)網(wǎng)站維護(hù)企業(yè)建站商城網(wǎng)站Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)