Hbase - copy one row from one table to another in diff env - Java -
i created hbaseconfiguration
both environments
.
get g = new get(bytes.tobyte("rowkey")); result r = envatable.get(g); put p = new put(bytes.tobyte("samerowkey")); p.add("need way add result"); envbtable.put(p);
solutions found:
iterate result, add each keyvalue
p
.
is there anyother way this?
since using get, result should contain 1 row. put, need row key, , list of col family, qualifier, value.
string rowid = new string(result.getrow()); put put = new put(bytes.tobytes(rowid)); for(cell cell : result.rawcells()) { put.add(cellutil.clonefamily(cell), cellutil.clonequalifier(cell), cellutil.clonequalifier(cell)); } envbtable.put(put);
cellutil way extract cell details. hope know every cell has detail rowkey, family, qualifier, timestamp , value. can row key each cell, logical entire row. hope helps.
and long have envbtable set up, server same suppose, given have permission user.
if using shell, approach might different. might need script there too, have customize , there no standard way of suppose
Comments
Post a Comment