在hbaseutil中具體要做這些事,封裝一下方法:建立命名空間,建立表,判斷表是否存在,分割槽鍵生成,rowkey設計
重點的是分割槽鍵的設計和rowkey的生成
比較簡單
public static void createnamespace(string ns) throws ioexception
//判斷表是否存在
private static boolean tableexist(string tablename) throws ioexception
//建立表
public static void createtable(string tablename, string... cfs) throws ioexception
//建立表描述器
htabledescriptor htabledescriptor = new htabledescriptor(tablename.valueof(tablename));
//迴圈新增列描述器
for (string cf : cfs)
int regions = integer.parseint(propertyutil.getproperty("hbase.regions"));
//建立表操作
admin.createtable(htabledescriptor, getsplits(regions));
//關閉資源
admin.close();
connection.close();
}
見部落格
作用:* 1.建立命名空間
* 2.建立表
* 3.封裝批量插入hbase資料的puts方法***
public class hbasedao
public void puts(string line) throws ioexception
//2.切割
string splits = line.split(",");
string call1 = splits[0];
string call2 = splits[1];
string buildtime = splits[2];
string duration = splits[3];
//3.封裝put物件
//獲取分割槽號
string parid = hbaseutil.getparid(call1, buildtime, regions);
//拼接rowkey
string row = hbaseutil.getrow(parid, call1, buildtime, call2, duration);
//建立put物件
put put = new put(bytes.tobytes(row));
//新增資料
put.addcolumn(bytes.tobytes(propertyutil.getproperty("hbase.cf")), bytes.tobytes("call1"), bytes.tobytes(call1));
put.addcolumn(bytes.tobytes(propertyutil.getproperty("hbase.cf")), bytes.tobytes("call2"), bytes.tobytes(call2));
put.addcolumn(bytes.tobytes(propertyutil.getproperty("hbase.cf")), bytes.tobytes("buildtime"), bytes.tobytes(buildtime));
put.addcolumn(bytes.tobytes(propertyutil.getproperty("hbase.cf")), bytes.tobytes("duration"), bytes.tobytes(duration));
//4.將put物件快取到集合中
puts.add(put);
//5.根據集合大小,寫到hbase,清空集合
if (puts.size() >= 20)
}public void close() throws ioexception
public void timeput() throws ioexception
}
電信客服專案之協處理器
協處理器在本專案中主要是用來,在向hbase中put一條資料時同時也要put一條call1和call2顛倒的資料 注意 1 協處理器如果是配置到hbase site.xml檔案中,預設是對全部的表都進行處理 2 如果不配置到xml檔案,只指定某個表,那麼就只對改表有效 3 注意將consumer進行...
遠傳技術助推廣東電信客服中心運營管理再公升級
近日,遠傳技術再次與老朋友廣東電信合作,採用u ccms運營管理系統,對號百外包呼叫中心進行全面公升級,最終實現客戶服務中心管理的流程化 標準化和規範化。隨著業務趨向多元化,廣東電訊號百外包客戶中心坐席數量已達3500以上,人員數量達4000以上。在這樣的規模效應下,對運營管理工作帶來巨大壓力,各方...
電信運營商工程專案管理
電信運營商工程專案管理 課程背景 電信行業投資規模巨大,投資方向多元化,專案數量成倍增長,管理人員的工作量急劇增加 專案性管理活動所涉及的範圍在迅速擴大,幾乎每一位員工在完成日常管理工作的同時都要承擔許多專案性的工作,而後者所占用的時間和精力越來越多。專案過程和環境更加複雜,失敗或延期的風險加劇,管...