您的位置:首页 > Web前端

Client-side Write Buffer 使用table.setAutoFlush(false)

2013-09-22 13:53 148 查看
p152 Hbase权威指南

The HBase API comes with a built in client-side write buffer that

collects put operations so that they are sent in one RPC call to the

server(s). The global switch to control if it is used or not is

represented by the following methods:

void setAutoFlush(boolean autoFlush)

boolean isAutoFlush()

By default the client-side buffer is not enabled. You activate the buffer

by setting auto flush to false, by invoking:

table.setAutoFlush(false)

This will enable the client-side buffering mechanism and you can

check the state of the flag respectively with the isAutoFlush()

method. It will return true when you initially create the HTable

instance. Otherwise it will obviously return the current state as set by

your code.

Once you have activated the buffer you can store data into HBase as

shown in the the section called “Single Puts” above. You do not cause

any RPCs to occur though, because the Put instances you stored are

kept in memory in your client process. When you want to force the

data to be written you can call another API function:

void flushCommits() throws IOException
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: