hbase學習筆記 增刪改查操作

2021-10-04 03:01:22 字數 2474 閱讀 9834

>

>

>

org.apache.hbasegroupid

>

>

hbase-clientartifactid

>

>

1.2.1version

>

dependency

>

>

>

org.apache.hbasegroupid

>

>

hbase-commonartifactid

>

>

1.2.1version

>

dependency

>

>

>

junitgroupid

>

>

junitartifactid

>

>

4.12version

>

dependency

>

dependencies

>

public

class

testhbase

}

/**

* 建表

* @throws exception

* hbase shell------> create 'tablename','列族1','列族2'

*/@test

public

void

createtable()

throws exception

/**

* 修改表

* @throws exception

*///hbase shell alter 't_user_info' ,'base_info',

// alter 't1', name => 'f1', versions => 5

@test

public

void

modifytable()

throws exception

4、put新增資料

/**

* put新增資料

* @throws exception hbase shell put 't_user_info','rk00001','base_info:name','lisi'

*/@test

public

void

testput()

throws exception

/**

* 讀取資料 get:一次讀一行

* @throws exception

* hbase shell : get 't_user_info',"rowkey"

*/@test

public

void

testget()

throws exception

//關閉

table.

close()

; conn.

close()

;}

/**

* scan 批量查詢資料

* @throws exception hbase shell scan 't_user_info'

*/@test

public

void

testscan()

throws exception

system.out.

println

("-----------------------");

}//關閉

table.

close()

; conn.

close()

;}

/**

* 刪除表中的列資料

* @throws exception

* hbase shell delete 't_user_info','user001','base_info:password'

*/@test

public

void

testdel()

throws exception

/**

* 刪除表

* @throws exception

* hbase shell 先disable 't_user_info' 然後drop 't_user_info'

*/@test

public

void

testdrop()

throws exception

hbase 增刪改查

兩篇可以參考的文章,講的不錯 hbase web操作 訪問位址 http hmaster 60010,hmaster的ip配置在 hbase home conf hbase site.xml中 ip對映成主機名,在env hosts中配置 在windows系統中的c windows system32...

HBase命令 三 增刪改查

新增 語法 put 新增或者覆蓋資料 put 表名 鍵名 列名 不是列簇名 值 指定的列名下單元格有值就覆蓋.沒有值就建立.所以hbase的新增資料和修改資料都是put語句.最後的時間戳可以不寫.預設為系統時間,如果要寫.切記不可使用引號括起來 hbase shell put mytable wos...

學習筆記(shell操作mysql增刪改查)

昨天學習了如何用shell對mysql資料表增刪改查,做了乙個小例子,望與大家共勉,不足之處請大家多多指教。如下 bin bash mysql2.sh n mysql mysql uroot pxz123456 case 1 in select sql select from test.2 dele...