HBaseConfiguration config = new HBaseConfiguration();
config.set("hbase.master", "foo.bar.com:60000");On Thu, May 14, 2009 at 8:32 AM, monty123 <[email protected]> wrote: > > Hi All, > > I am a newbie to hbase. > I am able to setup hbase in pseudo-distributed mode and I have also done > with its integration from Java. ( java client class and hbase were on same > system ) > > Now, I have no idea how to change configuration to access hbase from a > remote client ( like mysql jdbc conn. where se can change ip of server from > localhost to other ) > > Please help. > > Thanks in advance. > > Following is my java client code : > > import org.apache.hadoop.hbase.client.HTable; > import org.apache.hadoop.hbase.HBaseConfiguration; > import org.apache.hadoop.hbase.io.RowResult; > > import java.util.HashMap; > import java.util.Map; > import java.io.IOException; > > public class HBaseConnector { > > public static Map retrievePost(String postId) throws IOException { > HTable table = new HTable(new HBaseConfiguration(), "blogposts"); > Map post = new HashMap(); > > RowResult result = table.getRow(postId); > > for (byte[] column : result.keySet()) { > post.put(new String(column), new String(result.get(column).getValue())); > } > return post; > } > > public static void main(String[] args) throws IOException { > Map blogpost = HBaseConnector.retrievePost("post1"); > System.out.println(blogpost.get("post:title")); > System.out.println(blogpost.get("post:author")); > } > } > > > > -- > View this message in context: > http://www.nabble.com/Set-hbase-configuration-when-client-is-on-different-machine-tp23535721p23535721.html > Sent from the HBase User mailing list archive at Nabble.com. > > -- Sasha Dolgy [email protected]
