HBase API Put

来源:互联网 发布:淘宝信誉评级在哪看 编辑:程序博客网 时间:2024/05/17 12:02

Put(byte[] rowArray, int rowOffset, int rowLength, long ts)  We make a copy of the passed in row key to keep local

Put(byte[] row)  Create a Put operation for the specified row.

Put(byte[] row, long ts) Create a Put operation for the specified row, using a given timestamp.创建一个指定行,使用给定的时间戳

add(byte[] family, byte[] qualifier, byte[] value)  Add the specified column and value to this Put operation.添加指定的列和值

性能

setWriteToWAL: WAL是Write Ahead Log的缩写,指的是HBase在插入操作前是否写Log。默认是打开,关掉会提高性能,但是如果系统出现故障(负责插入的Region Server挂掉),数据可能会丢失。

另外HTable也有两个方法也会影响插入的性能

setAutoFlash: AutoFlush指的是在每次调用HBase的Put操作,是否提交到HBase Server。默认是true,每次会提交。如果此时是单条插入,就会有更多的IO,从而降低性能.

setWriteBufferSize: Write Buffer Size在AutoFlush为false的时候起作用,默认是2MB,也就是当插入数据超过2MB,就会自动提交到Server


原创粉丝点击