使用Java数据传入Hbase
public static void main(String[] args)throws IOException
{
init();
createTable("result_time",new String[] {"times"});
String pathname = "/home/hadoop/下载/file/kpi_time"; // 绝对路径或 相对路径都可以,写入文件时演示相对路径,读取以上路径的input.txt文件
String []time1={ };
try (FileReader reader = new FileReader(pathname);
BufferedReader br = new BufferedReader(reader) // 建立一个对象,它把文件内容转成计算机能读懂的语言
) {
String line;
while ((line = br.readLine()) != null) {
String []time=line.split("\t");
// 一次读入一行数据
insertData("result_time",time[0],"times",time[1],line);
}
} catch (IOException e) {
e.printStackTrace();
}
}