简体   繁体   中英

User used by Java Client API to access Hbase

I am learning Hbase.I want to know a Java Client will communicate with Hbase data ? I can see there are config ,HConnectionManager Classes to communicate with Hbase.I am curios to understand which userID does the client uses for this communication.

For Example : Say, I am running a hbaseTest.jar (ie My Java Client Jar file) from my local. My user ID : learner. and my /apps/data for hbase has the owner hbase.

What is the user Id used by my Java Client?

Thanks in advance !

You can use the following to get the user:

import org.apache.hadoop.hbase.security.User;

User u = User.getCurrent();
System.out.println(u.getName());

To change the use which you want to access Hbase, you can set environment variable for ("HADOOP_USER_NAME", "yourNewUser"). In eclipse, you can set in Run Configurations -> Arguments -> VM arguments -> -DHADOOP_USER_NAME=pedapna

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM